Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HAPI responses should include the JSON schema reference #134

Open
jvandegriff opened this issue Dec 3, 2021 · 4 comments
Open

HAPI responses should include the JSON schema reference #134

jvandegriff opened this issue Dec 3, 2021 · 4 comments
Milestone

Comments

@jvandegriff
Copy link
Collaborator

And the schemas should be put online with DOIs.

@jvandegriff jvandegriff added this to the Version 3.2 milestone Apr 3, 2023
@jvandegriff
Copy link
Collaborator Author

How to reference the schema is not too hard: probably add a link to it in the status block, for example.

Question: is there a standard way for JSON to advertise the presence of a schema?

Question: are there multiple JSON schema syntax options? Ans: they seem to have converged and we use: json-schema.org

This will take some research and time.

Need to then add schema refs to all the examples.

Should 3.2 require a schema to be present? Maybe wait for 4.0 to require it?

@jvandegriff
Copy link
Collaborator Author

There is no standard way for JSON to announce that it is following a schema.
Also, JSON Does not have namespaces. See this issue from the JSON schema people:

json-schema-org/json-schema-spec#828

So how we manage this is probably up to us.

From https://cdaweb.gsfc.nasa.gov/hapi/capabilities

{
  "$schema": "https://hapi-server.org/schemas/3.2/schema",
  -OR- one schema for each end point
  "$schema": "https://hapi-server.org/schemas/3.2/capabiliites/schema",

  "HAPI": "2.0",
  "status": {"code": 1200, "message": "OK"},
  "outputFormats": ["csv","json","binary"]
}

Probably one line is enough.

Maybe consider putting the web link in the schema key:

  "$https://json-schema.org/schema": "https://hapi-server.org/schemas/3.2/schema",
  -OR- one schema for each end point
  "$https://json-schema.org/schema": "https://hapi-server.org/schemas/3.2/capabiliites/schema",

@rweigel
Copy link
Contributor

rweigel commented Apr 17, 2023

Conclusion:

  1. Add refs to the applicable schema in HAPI schema definition files as $schema
  2. Require something like (ideally) $schema: "https://hapi-server.org/schemas/HAPI-3.2.json#capabilites" in all responses. It may be that we would have to split up a single file `$schema: "https://hapi-server.org/schemas/3.2/capabilites", which will take some effort.

Wait on item 2. till version 4.0.

Do item 1. asap.

@rweigel rweigel modified the milestones: Version 3.2, Version 4.x May 1, 2023
@rweigel
Copy link
Contributor

rweigel commented Mar 25, 2024

Item 1. is tracked in #188

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants