Skip to content

Support for plugins / types that implement custom vocabularies #2576

@a-recknagel

Description

@a-recknagel

Jsonschema allows for the definition of custom vocabularies which may or may not be supported by tooling like this project. Let's say I have something like this

{
  "type": "object",
  "properties": {
    "ibanFormat": {
      "type": "boolean",
      "description": "Indicates that the instance must be a valid IBAN."
    }
}

as a meta-schema which I'd somehow bind into my actual schema in order to use it like so:

{
  "properties": {
    "my_iban": {
      "title": "My Iban",
      "type": "string",
      "ibanFormat": true
    }
  },
  "required": [
    "my_iban"
  ],
  "title": "Foo",
  "type": "object"
}

How could I tell datamodel-code-generator that there is some type that satisfies this condition? What would be the constraints to fulfill this, do I need to provide a function that'd be used as a validator, or a complete type that inherits from pydantic.Baseclass? And how would I plug them in?

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