swagger-api / swagger-core

Examples and server integrations for generating the Swagger API Specification, which enables easy access to your REST API

Home Page:http://swagger.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RFC: Improved support for JSONSchema route hosting

cdaringe opened this issue · 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
  ...
}