Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-18829

camel-yaml-dsl - generate-yaml-schema - Support `additionalProperties: false`

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.21.0, 4.0-M1, 4.0.0
    • camel-yaml-dsl
    • None
    • Unknown

    Description

      JSON schema requires `additionalProperties: false` to be specified to prohibit additional properties those are not explicitly defined in `properties`
      https://json-schema.org/understanding-json-schema/reference/object.html#additional-properties
      And it doesn't propagate to the children, i.e. `additionalProperties: false` needs to be specified on each object definition.

      Since camel-yaml-dsl/generate-yaml-schema mojo doesn't add this property at this moment, the generated schema doesn't really restrict properties. We want to add an option 'additionalProperties" on generate-yaml-schema mojo, and if it's false, add `additionalProperties: false` on each objects in generated schema so that it declares explicit restriction. The option should be `true` by default so that it doesn't add anything in order to preserve current behavior.

      An example of having `additionalProperties` to be `false`
      https://github.com/igarashitm/example-generate-yaml-schema/blob/main/pom.xml#L71

      And generated YAML schema from it
      https://github.com/igarashitm/example-generate-yaml-schema/commit/85441fdcc6c641a2ef02aea7149a66a0429b3c92#diff-b1d8ab8b59f212acab62fab8cab033f98736c4bd9e92cc34fcf9b53457dbc1d0

      Attachments

        Issue Links

          Activity

            People

              igarashitm Tomohisa Igarashi
              igarashitm Tomohisa Igarashi
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: