Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG :: json-schema built-in formats not always used #7

Closed
gdbrown opened this issue Apr 3, 2016 · 1 comment
Closed

BUG :: json-schema built-in formats not always used #7

gdbrown opened this issue Apr 3, 2016 · 1 comment
Assignees
Labels

Comments

@gdbrown
Copy link
Contributor

gdbrown commented Apr 3, 2016

Anywhere there's a possibility to use a built-in format it should populate the format property.
http://spacetelescope.github.io/understanding-json-schema/reference/string.html#built-in-formats

Example where it doesn't:

    "ctx_ip": {
      "type": "string",
      "minLength": 0,
      "maxLength": 255,
      "pbj": {
        "type": "string",
        "rule": "single",
        "format": "ipv4",
        "overridable": true
      }
    },

There are also our custom formats that are not enforced by a pattern...

    "provider": {
      "type": "string",
      "minLength": 0,
      "maxLength": 20,
      "pbj": {
        "type": "string",
        "rule": "single",
        "format": "slug"
      }
    },

Using format of slug on a pbj must result in a pattern on the item with the slug regex pattern, which is in StringType in pbj. see StringType and Format class in pbj lib, ref aws3 branch

@gdbrown
Copy link
Contributor Author

gdbrown commented Apr 4, 2016

when a format that we use internally is not a public format (like ipv4) then it should be a regex pattern with the proper type (for example, slug would be type string and we'd put in the regex to validate it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants