Skip to content

feat: new JSONSchema and auto-inference for basic types #74

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

Closed
wants to merge 11 commits into from

Conversation

cyrilletuzi
Copy link
Owner

@cyrilletuzi cyrilletuzi commented Jan 27, 2019

Fixes #64.

Simplify validation by:

  • refactoring the JSONSchema type, to avoid all the TypeScript issues that arised in v7
  • auto-infering the returned type for basic types, so explicit casting is no longer needed

Includes breaking changes:

  • For numbers:

    • deprecates JSONSchemaNumeric in favor of JSONSchemaNumber and JSONSchemaInteger
  • For constants:

    • removes JSONSchemaConst
    • const is now part of JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaInteger and JSONSchemaString
    • consequence: type is now required
  • For enums:

    • removes JSONSchemaEnum
    • enum is now part of JSONSchemaNumber, JSONSchemaInteger and JSONSchemaString
    • consequence: type is now required
    • consequence: enums of different types are no longer possible (and it's better for consistency)
  • For arrays:

    • type: 'array' is now required
    • items no longer accepts an array of JSON schemas
    • consequence: arrays with multiple types are no longer possible (and it's better for consistency, use an object if you mix types in a list)
  • For objects:

    • type: 'object' is now required
  • Removes JSONSchemaNull (makes no sense and can cause interoperability issues)

  • Unsupported properties of the JSON schema standard are no longer accepted.

@cyrilletuzi cyrilletuzi self-assigned this Jan 27, 2019
@cyrilletuzi cyrilletuzi added this to the v8.0 milestone Jan 27, 2019
@cyrilletuzi cyrilletuzi changed the title feat: new JSONSchema, and shortcuts and auto-inference for basic types feat: new JSONSchema and auto-inference for basic types Jan 27, 2019
@cyrilletuzi
Copy link
Owner Author

Closed as it's merged in v8beta branch.

@cyrilletuzi cyrilletuzi closed this Feb 4, 2019
@cyrilletuzi cyrilletuzi deleted the newjsonschema branch February 7, 2019 16:09
@cyrilletuzi cyrilletuzi restored the newjsonschema branch March 3, 2019 17:07
@cyrilletuzi cyrilletuzi reopened this Mar 3, 2019
@cyrilletuzi cyrilletuzi closed this Mar 3, 2019
@cyrilletuzi cyrilletuzi deleted the newjsonschema branch March 3, 2019 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant