Skip to content

Feature Request: specify additionalProperties: false as a global default #135

@janeklb

Description

@janeklb

I'm trying to make a strict json schema where no additional properties are allowed in any field. The schema is nested and has a lot of type: object fields, and so I'm having to manually add additionalProperties: false to each type: object.

It would be great if one could set a "default override" for this field, so that the only time you would need to specify additionalProperties is to set it to true (in order to allow additional properties)

eg. such that the following schema docs

# @schema
# type: object
# properties:
#   instanceType:
#     type: string
#   enabled:
#     type: boolean
#   image:
#     type: object
#     properties:
#       tag:
#         type: string
#   options:
#     type: object
#     additionalProperties: true
# @schema
configuration: {}

would yield a schema (when created with this new feature enabled) that does not allow additional properties on configuration.image (ie. only configuration.image.tag is valid), but would allow additional properties on configuration.options.

eg. helm-docs --noAdditionalPropertiesByDefault (that's a mouthful.. perhaps it might be good to offer a more flexible flag like --defaultOverride additionalProperties:false? just ideas though)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions