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

Generalize ResultsetInstance #162

Open redmitry opened 2 months ago

redmitry commented 2 months ago

The main idea is defined in the short presentation Generalizing Beacon 2.0 Schema (presented at GA4GH Discovery Workstream 2024-04-09). This doesn't break framework format, but put the requirement for support 2020-12 JSON schema (which is already supposed to be Beacon v2.0 JSON schema version).

The improvement would allow:

  1. Validate beaconResultsetsResponse together with concrete results (e.g. "individuals") entryTypes in one pass.
  2. OpenAPI tools may (if supports 2020-12) generate better clients that include data model types.

Cheers,

Dmitry

costero-e commented 2 months ago

Hi @redmitry. Link to the presentation gives 404. Do you have it elsewhere?

redmitry commented 2 months ago

Hi @redmitry. Link to the presentation gives 404. Do you have it elsewhere?

Fixed.

Basically, OpenAPI ResultsOKResponse may have something like

"oneOf": [
  {
    "$comment": "generics test",
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "$defs": {
       "biosamples": {
         "$dynamicAnchor": "resultsEntryType",
         "$ref": "https://raw.githubusercontent.com/redmitry/beacon-v2/redmitry-generalize-resultset/models/json/beacon-v2-default-model/biosamples/defaultSchema.json"
        }
    },
    "$ref" : "https://raw.githubusercontent.com/redmitry/beacon-v2/redmitry-generalize-resultset/framework/json/responses/beaconResultsetsResponse.json"
  },
  ...
]

The schema above validates ResultsetsResponse where resultSets are biosamples entryType.

D.

costero-e commented 1 month ago

I have tested this and it worked fine. For me it's a +1. We would need a proposal on how endpoints would look like using this schema composition.