swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

RFC: Improved support for JSONSchema route hosting

Open cdaringe opened this issue 1 year ago • 0 comments

Problem

I need a JSONSchema URL to type some entity (such as a JSONFile, yaml file), e.g.:

{
  "$schema": "https://petstore.com/api/schemas/foo/bar",
  "bar": { ... }
}

...but such a standard in the swagger specification doesn't exist.

Without this capability, I cannot enable great features like intellisense in my IDE without first downloading the swagger.json and performing a transformation.

Discussion

  • Hosting a dedicated route(s) for supplying raw JSONSchema would be an excellent addition to the core offerring.
  • We go to great lengths to build JSONSchema models, but we don't expose them in their natural form.
  • JSONSchema likes to be hosted at URIs that produce raw/idiomatic JSONSchema: https://json-schema.org/understanding-json-schema/structuring#schema-identification, which is helpful for integrating with some tools

Desired, example behavior:

curl https://petstore.com/api/schemas/SCHEMA_NAME # or similar

{ # JSONSchema document just for that SCHEMA_NAME
  ...
}

cdaringe avatar Apr 18 '24 16:04 cdaringe