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

Avoid $ref in /queryables #153

Open
m-mohr opened this issue Feb 15, 2023 · 0 comments
Open

Avoid $ref in /queryables #153

m-mohr opened this issue Feb 15, 2023 · 0 comments

Comments

@m-mohr
Copy link

m-mohr commented Feb 15, 2023

Neither a bug nor really a feature, so opening a blank issue.

The /queryables endpoints refer to external schemas using $ref. This leads to a lot of downstream HTTP requests in clients, e.g. STAC Browser. For example requesting https://planetarycomputer.microsoft.com/api/stac/v1/queryables has a single field defined, which pretty much just refers to a very simple JSON Schema of like 30 bytes: { "type": "string", "minLength": 1 }. For this simple schema. the client has to sends 8(!) http requests returning a total of nearly 10.000 bytes. Could this be improved?

Two alternative solutions could be considered:

  1. Inline at least the simple schemas.
  2. Bundle the schema on the server-side and return the bundled schema.

I'd prefer version 2 as it just is much more lightweight on the clients, which don't need to carry a full $ref parser library. $refs itself are also pretty ill-defined with a lot of different implementation, so the interoperability is pretty bad. The JSON Schema community is currently discussing this, but that will take more time: https://github.com/json-schema-org/referencing https://phil.tech/2022/bundling-openapi-with-javascript/

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

1 participant