question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow JSON schema id and $schema in OpenAPI schema definitions

See original GitHub issue

JSON Schema files can contain top-level fields id and $schema. When using $ref in an OpenAPI document to reference an external schema, the OpenAPI tooling rejects JSON schema files that contain one or both of these fields because 1) the spec does not allow additional fields and thus 2) the published JSON Schema document for OpenAPI does not allow additional fields. See https://github.com/whitlockjc/swagger-lint/issues/11 for some specific examples.

I propose changing the spec and the corresponding OpenAPI 3.0 schema to allow id and $ref so that one can publish OpenAPI model definition as JSON schema documents. This will allow more tools to consume them more fully.

Note: I am not requesting OpenAPI change the allowed subset of JSON Schema features.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
darrelmillercommented, Apr 3, 2018

This issue will be addressed if we can make headway on the alternate schema proposal. Whitelisting certain properties I fear will just open the door to whitelisting “just one more property” and the end result will be confusion as to what tooling supports, ignores and doesn’t support.

1reaction
philsturgeoncommented, Jan 9, 2020

Added in #1977 so we can close this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

OpenAPI Specification - Version 3.0.3 - Swagger
Models are defined using the Schema Object, which is an extended subset of JSON Schema Specification Wright Draft 00. Primitives have an optional...
Read more >
Validating OpenAPI and JSON Schema
Dynamic references make it possible to validate the schemas in an OpenAPI document even though OpenAPI does not constrain which JSON Schema ......
Read more >
JSON Schema vs. OpenAPI - codeburst
In JSON Schema, an empty object, {} , is a completely valid schema that will accept any valid JSON (any object, number, string,...
Read more >
OpenAPI Specification v3.1.0 | Introduction, Definitions, & More
Relative references in Schema Objects , including any that appear as $id values, use the nearest parent $id as a Base URI, as...
Read more >
JSON Schema At Home in the OpenAPI Specification - YouTube
Ben Hutton, JSON SchemaOpenAPI 3.1.0 will bring full support for JSON Schema 2019-09 (hopefully 2020-NN).Draft 2019-09 represents the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found