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

Support for specifying extension keywords (properties) with an "x-" prefix #1083

Commits on Jan 27, 2020

  1. Configuration menu
    Copy the full SHA
    d05dca6 View commit details
    Browse the repository at this point in the history
  2. Support for specifying extension keywords (properties) with an "x-" p…

    …refix
    
    Extensions to the json-schema specification, like the "javaType" keyword property, can trip up json schema validator tools that don't recognize the keywords and thus report errors. By convention, though, validator tools will ignore any keywords prefixed with "x-". Thus, any keyword extension to the specification should really be a keyword that begins with "x-".
    
    In order to support "x-" prefixed versions of existing keyword extensions, while maintaining backward compatibility, the following change are made:
    
    Change all references to node properties that are extensions to the specification such that they use helper methods (`ExtensionsHelper.java`) that will work on both the original extension name (e.g. "javaType") and also that name prefixed with 'x-' (e.g. `x-javaType`). The following keywords are affected:
    
    - `extends`, `javaType`, `existingJavaType`, `extendsJavaClass`, `javaInterfaces`, `javaEnumNames`, `javaEnums`, `javaJsonView`, `javaName`, `customPattern`, `customTimezone`, `customDatePattern`, `customTimePattern`, `customDateTimePattern`, `excludedFromEqualsAndHashCode`
    
    Update all message text references to any of the above to use "x-".
    
    Duplicate existing test schema files & directories that exercise the above keywords and either duplicate the unit tests that use them (to use the new schemas) or parameterize the test suites that use them to operate on both the original test schema and the new "x-" variant.
    
    Further test update details:
    
    Due to a mix of tests in TypeIT.java, break out the tests from TypeIT.java that didn't use the common schema with many types to a separate test class, TypeMiscIT.java. (and the same for YamlTypeIT.java). This allowed parameterizing TypeIT.java without running some tests twice on the same input.
    
    Update some other test schemas that use extension keywords (but don't explicitly validate them) to use the new "x-" variant as this should be the preferred variant for reasons stated above.
    
    While here, add test variants of each of the above 'custom*Patterns' that use the x-customPattern alias (no tests had existed for the 'customPattern' alias)
    rajpaulbagga committed Jan 27, 2020
    Configuration menu
    Copy the full SHA
    27b7eef View commit details
    Browse the repository at this point in the history
  3. Integration test to make sure that both the legacy (un-prefixed) and …

    …"x-" prefixed versions of an extension keyword cannot be used in the same node.
    rajpaulbagga committed Jan 27, 2020
    Configuration menu
    Copy the full SHA
    a68ef23 View commit details
    Browse the repository at this point in the history