Code Monkey home page Code Monkey logo

Comments (4)

handrews avatar handrews commented on June 3, 2024 1

@Speeddymon this would be done by adding new formats - we can't change existing formats (some of which are specified by JSON Schema and not OpenAPI) as that will break existing users who would consider accepitng a CIDR or netmask for format: ipv4 to be an error. So we'd add more formats. This can be done by opening a PR on the format registry, which lives on the gh-pages branch in this repository.

Typically we'd add a format for each thing, and then you would use anyOf or oneOf to say that something could be either an address or a netmask, etc.

from openapi-specification.

Speeddymon avatar Speeddymon commented on June 3, 2024 1

Upon re-reading with that context, this makes sense. I'll submit a PR for consideration, thank you!

from openapi-specification.

Speeddymon avatar Speeddymon commented on June 3, 2024

Thanks @handrews.

I have taken a look at the gh-pages branch in registries/_format/ipv4.md and followed the link to the JSONSchema definition:

An IPv4 address according to the "dotted-quad" ABNF syntax as defined in RFC 2673, section 3.2 [RFC2673].

Following the link to RFC2673 section 3.2 (direct link to the relevant section here) states:

A Bit-String Label is represented in text -- in a zone file, for
example -- as a surrounded by the delimiters "[" and "]".
The is either a dotted quad or a base indicator and a
sequence of digits appropriate to that base, optionally followed by a
slash and a length. The base indicators are "b", "o" and "x",
denoting base 2, 8 and 16 respectively. The length counts the
significant bits and MUST be between 1 and 32, inclusive, after a
dotted quad, or between 1 and 256, inclusive, after one of the other
forms. If the length is omitted, the implicit length is 32 for a
dotted quad or 1, 3 or 4 times the number of binary, octal or
hexadecimal digits supplied, respectively, for the other forms.

So, is jsonschema wrong in not supporting the optional slash and length indicator? Should I open an issue upstream before considering to submit a new format here?

from openapi-specification.

handrews avatar handrews commented on June 3, 2024

@Speeddymon the key part of the text there is according to the "dotted-quad" ABNF syntax

What that means is that only this part of the ABNF (the "dotted-quad" production and its dependency, "decbyte") is relevant.

     dotted-quad      =  decbyte "." decbyte "." decbyte "." decbyte

     decbyte          =  1*3DIGIT

So no, jsonschema is not wrong.

If you want a format that corresponds to the "bit-string-label" production, that would be a separate format from the existing IP v4 format.

from openapi-specification.

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.