Skip to content

Add support for patternProperties in schemas #687

Closed
@dolmen

Description

@dolmen

JSON Schema draft 4 has patternProperties which is not supported by Swagger 2.0.
patternProperties allows to have loosely defined objects where the list of keys is not fixed in the spec (like additionalProperties allows in Swagger 2.0), but the format of the keys is restricted with a regexp (contrary to additionalProperties where keys are not at all limited).

Here is a use case from #380:

name: pop
description: population by country
type: object
patternProperties:
  '^[A-Z]{2}$':
    type: integer
    description: the population of the country indicated by the property name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions