ga4gh-beacon / beacon-v2

Unified repository for the GA4GH Beacon v2 API standard
Creative Commons Zero v1.0 Universal
27 stars 22 forks source link

Schemas missing $id #20

Open mbaudis opened 3 years ago

mbaudis commented 3 years ago

Schemas should have $id parameters.

Example: "$id": https://progenetix.org/services/schemas/BeaconServiceError/v2021-03-07

jrambla commented 3 years ago

Agree. they are not there (yet) for two reasons:

  1. OpenAPI 3.0.2 doesn't support it
  2. It requires an stable path which we haven't agreed upon yet.

Should we simply use the stable URL provided by GitHub "tag/release" or should we go for something more sofisticated?

mbaudis commented 2 years ago

Old but still relevant. Transferring to unified repository.

jrambla commented 2 months ago

@redmitry @datsirul I've been confused by the $id in the Json Schemas, the actual usefulness and its compatibility with OA... Do you have insights or opinions on this topic?

redmitry commented 2 months ago

I would be cautious in using "$id" unless we think well the schemas structure. In JSON schema "$id" is a schema (subschema) context which is used to the "$ref" resolution. There are MANY ways to use (and resolve) "$ref" in the schema;:

  1. absolute URL - "https://myschema.com/schema_file.json"
  2. anchor - "#my_anchor_name"
  3. relative - "/my_other_schema_file.json"
  4. self - "#/$def/my_element" The problem here is "relative" as it must be resolved against the "$id". So imagine you download the schema locally. the $ref will go to the original site in this case.

We may use relative "$id" so it would be relative to the root, but not sure do we need it and what the gain,

D.