Code Monkey home page Code Monkey logo

Comments (8)

ahx avatar ahx commented on May 18, 2024 1

Reopening, because current implementation does not work with allOf, oneOf :|

from openapi_first.

JF-Lalonde avatar JF-Lalonde commented on May 18, 2024 1

@ahx Good to know! We've actually adopted the type: ['null',string] already even though it's not officially supported. But we'll probably be upgrading to 3.1 soon.

from openapi_first.

ahx avatar ahx commented on May 18, 2024

json_schemer is currently not a good place to impement something like that.
Here's an idea for a new rubygem:

require 'openapi-json-schema-converter'
OpenapiJsonSchemaConverter.new(openapi_json_schema).call(data) # => standard_json_schema

from openapi_first.

tristandruyen avatar tristandruyen commented on May 18, 2024

@ahx
FYI this is a workaround we found:

some_thing:
  oneOf:
    - type: 'null'   # Note the quotes around 'null'
    - type: string

which could be improved once OpenAPI 3.1 (#46) is supported to:

some_thing:
  type: ['null',string]

so does this even need to stay open?

from openapi_first.

ahx avatar ahx commented on May 18, 2024

type: ['null',string] should work, even though it is not officially supported by OAS 3.0.

I think supporting nullable would be useful, because we could use standard OAS linters that would fail when using type: ['null',string]. OAS 3.1 solves all this, but unfortunately it has not reached RC status, yet.

from openapi_first.

ahx avatar ahx commented on May 18, 2024

This should be obsolete with OAS 3.1, since nullable will be removed from OpenAPI 3.1 and type arrays will be valid type: ['null', string ] 👍.
I think we can close this.

from openapi_first.

ahx avatar ahx commented on May 18, 2024

Reopening, because I want to support OpenAPI 3.0.x

from openapi_first.

ahx avatar ahx commented on May 18, 2024

@JF-Lalonde nullable has been removed from OAS since 3.1. Is updating your spec to 3.1 an option for you/your team?

from openapi_first.

Related Issues (20)

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.