Skip to content

Variable schemas for OASv2 and OASv3 (edge case) #18

Closed
@MikeRalphson

Description

My example is Microsoft's x-ms-paths (docs). Where x-ms-paths is an analogue of the paths property (i.e. it contains pathItem Objects).

I'm assuming MS will continue to use x-ms-paths with OASv3, as the problem it 'solves' is unchanged in OASv3. So in OASv2 it will be structured like a container of OASv2 pathItem Objects and OASv3 pathItem Objects in OASv3.

So, would something like the following be valid?

#...
com.microsoft:
  x-ms-paths:
  #...
    schema:
      oneOf:
      - $ref: https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v2.0/schema.json#/definitions/Paths
      - $ref: https://raw.githubusercontent.com/OAI/OpenAPI-Specification/49e784d7b7800da8732103aa3ac56bc7ccde5cfb/schemas/v3.0/schema.yaml#/definitions/Paths

And does it provide enough information as to the context for the use of each schema? Without some kind of hint, it seems to me that the schema would be only really suitable for validation, not auto-completion (generated documentation would be partially useful).

I think an OASv2 schema object is a proper subset of the OASv3 schema object, unless it references type: file or discriminator.

One option would be to have a schema property under the oas2 and oas3 properties which overrides the default schema. Then each could be defined as their appropriate type from the relevant spec. version (refs #4, #8 (comment)), and we gain a mechanism to support OASv4 etc. It would still be up for debate as to whether the top-level schema should be JSON-Schema draft X or some version of OpenAPI-Schema.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions