Giter Club home page Giter Club logo

Comments (5)

grokify avatar grokify commented on August 11, 2024

Definition for github.com/getkin/kin-openapi/openapi3.Types is here:

https://pkg.go.dev/github.com/getkin/[email protected]/openapi3#Types

Definition for Schema.Type is as follows:

v0.124.0

Type         *Types       `json:"type,omitempty" yaml:"type,omitempty"`

Types is a []string:

type Types []string

https://pkg.go.dev/github.com/getkin/[email protected]/openapi3#Schema

v0.123.0

Type         string        `json:"type,omitempty" yaml:"type,omitempty"`

https://pkg.go.dev/github.com/getkin/[email protected]/openapi3#Schema

from spectrum.

grokify avatar grokify commented on August 11, 2024

Upstream merge links:

  1. getkin/kin-openapi#912
  2. getkin/kin-openapi#921

Additional discussion links:

  1. mattpolzin/OpenAPIKit#356
  2. OpenAPI Specification plugin erroneously requires schema type field to be an array when OpenAPI version is 3.1.0 youtrack.jetbrains.com/issue/IJPL-63311

from spectrum.

grokify avatar grokify commented on August 11, 2024

Spec discussion:

getkin/kin-openapi#563

In OpenAPIv3.0 type can only take a single string value per https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#properties

In OAS 3.0.3:

https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#properties

The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification.

  • type - Value MUST be a string. Multiple types via an array are not supported.

This is no longer the case in OAS 3.1.0.

This issue:

getkin/kin-openapi#563

Mentions this YAML impelmentation:

'Legal in v2':
  type: [boolean, string]

'Legal in v3.0':
  oneOf:
  - {type: boolean}
  - {type: string}

from spectrum.

grokify avatar grokify commented on August 11, 2024

It is best to validate that downstream tools like OpenAPI Generator, Docusaurus, Redoc and others behave as expected given use of oneOf.

from spectrum.

grokify avatar grokify commented on August 11, 2024

oapi-codegen PR changes for reference: https://github.com/oapi-codegen/oapi-codegen/pull/1532/files

from spectrum.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.