Skip to content

Option to exclude defined/evaluated properties from propertyNames #757

@strega-nil

Description

@strega-nil

I'm writing a schema for an internal config file, and I want to be able to 1) add comments (i.e., fields whose name starts with a #), 2) add a $schema, 3) use the properties that are necessary for configuration. How I thought I would do this is with:

{
  "type": "object",

  "propertyNames": {
    "pattern": "^[#\\$]",
    "#": "note, starts with a # or a $"
  },

  "required": [ "toolset", "..." ],

  "properties": {
    "toolset": { "...": "..." },
    "...": "..."
  }
}

However, both propertyNames and properties are checked, and so if I have toolset, it doesn't match against ^[#\\$]. I'm wondering if this is intentional, and if it is, what's a good workaround?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions