Skip to content

overlay

An object describing how to apply a pattern to a composition.

Classes

Overlay pydantic-model

Bases: BaseModel

An object describing how to overlay a pattern in a composition.

Show JSON schema:
{
  "$defs": {
    "Location": {
      "description": "The location of a file or directory.\n\nA location supports referencing the file or directory using:\n\n- relative path\n- absolute path\n- git URL\n- git URL plus revision/tag/branch plus path in the repo\n\nWhen `url` is specified, the `path` is relative to the root of the repository.\n\nAt least one of `path` or `url` must be specified.",
      "properties": {
        "path": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The relative or absolute path to the location.",
          "title": "Path"
        },
        "url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Git URL to the location.",
          "title": "Url"
        }
      },
      "title": "Location",
      "type": "object"
    }
  },
  "description": "An object describing how to overlay a pattern in a composition.",
  "properties": {
    "pattern_location": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "$ref": "#/$defs/Location"
        }
      ],
      "description": "The location of the pattern file for this overlay.",
      "title": "Pattern Location"
    },
    "ask_questions": {
      "default": true,
      "description": "Ask the user this pattern's questions? When false, the defaults are used.",
      "title": "Ask Questions",
      "type": "boolean"
    },
    "defaults": {
      "description": "Override one or more question's default values in this pattern. Values can be a template string.",
      "title": "Defaults",
      "type": "object"
    },
    "extra_context": {
      "description": "Override one or more keys in this pattern's `extra_context`. Values can be a template string.",
      "title": "Extra Context",
      "type": "object"
    },
    "answer_map": {
      "description": "This signifies that a previous overlay has already answered one or more of this pattern's questions. The key is this pattern's question name and the value is a template string that references or modifies a previous pattern's question name.",
      "title": "Answer Map",
      "type": "object"
    },
    "overwrite_files": {
      "description": "A list of paths or glob patterns of files that may be overwritten. An empty list means do not overwrite any files.",
      "items": {
        "type": "string"
      },
      "title": "Overwrite Files",
      "type": "array"
    },
    "exclude_files": {
      "description": "A list of paths or glob patterns of files to exclude from the generation (overrides the pattern's configuration)",
      "items": {
        "type": "string"
      },
      "title": "Exclude Files",
      "type": "array"
    }
  },
  "required": [
    "pattern_location"
  ],
  "title": "Overlay",
  "type": "object"
}

Fields:

Validators:

Attributes

answer_map pydantic-field
answer_map: dict

This signifies that a previous overlay has already answered one or more of this pattern’s questions. The key is this pattern’s question name and the value is a template string that references or modifies a previous pattern’s question name.

ask_questions pydantic-field
ask_questions: bool = True

Ask the user this pattern’s questions? When false, the defaults are used.

defaults pydantic-field
defaults: dict

Override one or more question’s default values in this pattern. Values can be a template string.

exclude_files pydantic-field
exclude_files: List[str]

A list of paths or glob patterns of files to exclude from the generation (overrides the pattern’s configuration)

extra_context pydantic-field
extra_context: dict

Override one or more keys in this pattern’s extra_context. Values can be a template string.

overwrite_files pydantic-field
overwrite_files: List[str]

A list of paths or glob patterns of files that may be overwritten. An empty list means do not overwrite any files.

pattern pydantic-field
pattern: Pattern

Lazy loading of the pattern from its location.

pattern_location pydantic-field
pattern_location: Union[str, Location]

The location of the pattern file for this overlay.

Functions

validate_pattern_location pydantic-validator
validate_pattern_location(
    value: Union[str, Location], info: ValidationInfo
) -> Location

Check that the pattern_location exists.

Functions