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.

Render JsonSchema constraints

See original GitHub issue
  • readOnly
  • minLength
  • maxLength
  • pattern
  • minItems
  • maxItems
  • multipleOf
  • defaults
  • file payload
  • readOnly - don’t show readOnly fields in request schema
  • No need to mark readOnly in response

to be continued…

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
fgaboldecommented, Apr 17, 2018

I don’t see the pattern in strings that are used as array items, e.g.:

# definition
HTTPSURL:
  type: string
  format: uri
  pattern: "^https?"
# this one displays "/^https?/" as expected
Thing:
  type: object
  properties:
    single:
      $ref: '#/HTTPSURL'
# this one does not
ManyThings:
  type: object
  properties:
    multiple:
      type: array
      items:
        $ref: '#/HTTPSURL'

I do see the <uri> from the format in both cases, and if I add minLength it works too.

This is Redoc 1.21.2.

1reaction
fgaboldecommented, Mar 9, 2018

Yeah, probably. Right now a size constraint on a string is represented like this:

  • [ 2 .. 8 ] characters with both constraints set
  • <= 8 characters, max only
  • >= 2 characters, min only

Just replacing “characters” with “items” sounds good to me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSON Schema in 5 minutes
JSON Schema is constraints based, meaning that anything not defined (or constrained) is allowed and considered valid.
Read more >
Render JsonSchema constraints #42 - Redocly/redoc - GitHub
In order to make this behavior clear, the readOnly constraint should be rendered on both requests and responses.
Read more >
Apply addtional constraints to a refered definition in JSON ...
To add constraints, you need to understand that $ref for draft-07 and previous is the only allowed key in a subschema when it...
Read more >
Introduction to JSON Schema in Java - Baeldung
JSON Schema Validation: The JSON Schema Validation specification is the document that defines the valid ways to define validation constraints.
Read more >
Other Internals - react-jsonschema-form documentation
Due to the limitation of form widgets, there are some exceptions as follows: ... it uses json-schema-merge-allof to merge subschemas to render 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