OpsMill Schema API

The Schema API from OpsMill — 6 operation(s) for schema.

OpenAPI Specification

opsmill-schema-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Infrahub Artifact Schema API
  version: 1.10.0
tags:
- name: Schema
paths:
  /api/schema:
    get:
      summary: Get Schema
      operationId: get_schema_api_schema_get
      security:
      - HTTPBearer: []
      - APIKeyHeader: []
      parameters:
      - name: namespaces
        in: query
        required: false
        schema:
          anyOf:
          - type: array
            items:
              type: string
          - type: 'null'
          title: Namespaces
      - name: branch
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Name of the branch to use for the query
          title: Branch
        description: Name of the branch to use for the query
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SchemaReadAPI'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Schema
  /api/schema/summary:
    get:
      summary: Get Schema Summary
      operationId: get_schema_summary_api_schema_summary_get
      security:
      - HTTPBearer: []
      - APIKeyHeader: []
      parameters:
      - name: branch
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Name of the branch to use for the query
          title: Branch
        description: Name of the branch to use for the query
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SchemaBranchHash'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Schema
  /api/schema/{schema_kind}:
    get:
      summary: Get Schema By Kind
      operationId: get_schema_by_kind_api_schema__schema_kind__get
      security:
      - HTTPBearer: []
      - APIKeyHeader: []
      parameters:
      - name: schema_kind
        in: path
        required: true
        schema:
          type: string
          title: Schema Kind
      - name: branch
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Name of the branch to use for the query
          title: Branch
        description: Name of the branch to use for the query
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                anyOf:
                - $ref: '#/components/schemas/APIProfileSchema'
                - $ref: '#/components/schemas/APINodeSchema'
                - $ref: '#/components/schemas/APIGenericSchema'
                - $ref: '#/components/schemas/APITemplateSchema'
                title: Response Get Schema By Kind Api Schema  Schema Kind  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Schema
  /api/schema/json_schema/{schema_kind}:
    get:
      summary: Get Json Schema By Kind
      operationId: get_json_schema_by_kind_api_schema_json_schema__schema_kind__get
      security:
      - HTTPBearer: []
      - APIKeyHeader: []
      parameters:
      - name: schema_kind
        in: path
        required: true
        schema:
          type: string
          title: Schema Kind
      - name: branch
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Name of the branch to use for the query
          title: Branch
        description: Name of the branch to use for the query
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSONSchema'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Schema
  /api/schema/load:
    post:
      summary: Load Schema
      operationId: load_schema_api_schema_load_post
      security:
      - HTTPBearer: []
      - APIKeyHeader: []
      parameters:
      - name: branch
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Name of the branch to use for the query
          title: Branch
        description: Name of the branch to use for the query
      - name: at
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Time to use for the query, in absolute or relative format
          title: At
        description: Time to use for the query, in absolute or relative format
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SchemasLoadAPI'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SchemaUpdate'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Schema
  /api/schema/check:
    post:
      summary: Check Schema
      operationId: check_schema_api_schema_check_post
      security:
      - HTTPBearer: []
      - APIKeyHeader: []
      parameters:
      - name: branch
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Name of the branch to use for the query
          title: Branch
        description: Name of the branch to use for the query
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SchemasLoadAPI'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Schema
components:
  schemas:
    ComputedAttribute-Input:
      allOf:
      - if:
          properties:
            kind:
              const: Jinja2
        then:
          properties:
            jinja2_template:
              type: string
              minLength: 1
          required:
          - jinja2_template
      - if:
          properties:
            kind:
              const: TransformPython
        then:
          properties:
            transform:
              type: string
              minLength: 1
          required:
          - transform
      properties:
        id:
          anyOf:
          - type: string
          - type: 'null'
          title: Id
        state:
          $ref: '#/components/schemas/HashableModelState'
          default: present
        kind:
          $ref: '#/components/schemas/ComputedAttributeKind'
        jinja2_template:
          anyOf:
          - type: string
          - type: 'null'
          title: Jinja2 Template
          description: The Jinja2 template in string format, required when assignment_type=jinja2
        transform:
          anyOf:
          - type: string
          - type: 'null'
          title: Transform
          description: The Python Transform name or ID, required when assignment_type=transform
      additionalProperties: false
      type: object
      required:
      - kind
      title: ComputedAttribute
    RelationshipKind:
      type: string
      enum:
      - Generic
      - Attribute
      - Component
      - Parent
      - Group
      - Hierarchy
      - Profile
      - Template
      title: RelationshipKind
    NodeExtensionSchema:
      properties:
        id:
          anyOf:
          - type: string
          - type: 'null'
          title: Id
        state:
          $ref: '#/components/schemas/HashableModelState'
          default: present
        kind:
          type: string
          title: Kind
        attributes:
          items:
            $ref: '#/components/schemas/AttributeSchema-Input'
          type: array
          title: Attributes
        relationships:
          items:
            $ref: '#/components/schemas/RelationshipSchema'
          type: array
          title: Relationships
      additionalProperties: false
      type: object
      required:
      - kind
      title: NodeExtensionSchema
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    SchemaExtension:
      properties:
        id:
          anyOf:
          - type: string
          - type: 'null'
          title: Id
        state:
          $ref: '#/components/schemas/HashableModelState'
          default: present
        nodes:
          items:
            $ref: '#/components/schemas/NodeExtensionSchema'
          type: array
          title: Nodes
      additionalProperties: false
      type: object
      title: SchemaExtension
    APIGenericSchema:
      properties:
        id:
          anyOf:
          - type: string
          - type: 'null'
          title: Id
          description: The ID of the node
          update: not_applicable
        state:
          $ref: '#/components/schemas/HashableModelState'
          description: Expected state of the node/generic after loading the schema
          default: present
          update: not_applicable
        name:
          type: string
          maxLength: 32
          minLength: 2
          pattern: ^[A-Z][a-zA-Z0-9]+$
          title: Name
          description: Node name, must be unique within a namespace and must start with an uppercase letter.
          update: migration_required
        namespace:
          type: string
          maxLength: 64
          minLength: 3
          pattern: ^[A-Z][a-z0-9]+$
          title: Namespace
          description: Node Namespace, Namespaces are used to organize models into logical groups and to prevent name collisions.
          update: migration_required
        description:
          anyOf:
          - type: string
            maxLength: 128
          - type: 'null'
          title: Description
          description: Short description of the model, will be visible in the frontend.
          update: allowed
        label:
          anyOf:
          - type: string
            maxLength: 64
          - type: 'null'
          title: Label
          description: Human friendly representation of the name/kind
          update: allowed
        branch:
          $ref: '#/components/schemas/BranchSupportType'
          description: Type of branch support for the model.
          default: aware
          update: not_supported
        default_filter:
          anyOf:
          - type: string
            pattern: ^[a-z0-9\_]*$
          - type: 'null'
          title: Default Filter
          description: 'Default filter used to search for a node in addition to its ID. (deprecated: please use human_friendly_id instead)'
          update: allowed
        human_friendly_id:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Human Friendly Id
          description: Human friendly and unique identifier for the object.
          update: allowed
        display_label:
          anyOf:
          - type: string
          - type: 'null'
          title: Display Label
          description: Attribute or Jinja2 template to use to generate the display label
          update: allowed
        display_labels:
          anyOf:
          - items:
              type: string
              deprecationMessage: display_labels are deprecated use display_label instead
            type: array
          - type: 'null'
          title: Display Labels
          description: List of attributes to use to generate the display label (deprecated)
          update: allowed
        include_in_menu:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Include In Menu
          description: Defines if objects of this kind should be included in the menu.
          update: allowed
        menu_placement:
          anyOf:
          - type: string
          - type: 'null'
          title: Menu Placement
          description: Defines where in the menu this object should be placed.
          update: allowed
        icon:
          anyOf:
          - type: string
          - type: 'null'
          title: Icon
          description: Defines the icon to use in the menu. Must be a valid value from the MDI library https://icon-sets.iconify.design/mdi/
          update: allowed
        order_by:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Order By
          description: List of entries to order results by. Supports attributes, relationship attributes, and node_metadata with __asc/__desc.
          update: allowed
        uniqueness_constraints:
          anyOf:
          - items:
              items:
                type: string
              type: array
            type: array
          - type: 'null'
          title: Uniqueness Constraints
          description: List of multi-element uniqueness constraints that can combine relationships and attributes
          update: migration_required
        documentation:
          anyOf:
          - type: string
          - type: 'null'
          title: Documentation
          description: Link to a documentation associated with this object, can be internal or external.
          update: allowed
        attributes:
          items:
            $ref: '#/components/schemas/AttributeSchema-Output'
          type: array
          title: Attributes
          description: Node attributes
          update: not_applicable
        relationships:
          items:
            $ref: '#/components/schemas/RelationshipSchema'
          type: array
          title: Relationships
          description: Node Relationships
          update: not_applicable
        hierarchical:
          type: boolean
          title: Hierarchical
          description: Defines if the Generic support the hierarchical mode.
          default: false
          update: validate_constraint
        generate_profile:
          type: boolean
          title: Generate Profile
          description: Indicate if a profile schema should be generated for this schema
          default: true
          update: validate_constraint
        used_by:
          items:
            type: string
          type: array
          title: Used By
          description: List of Nodes that are referencing this Generic
          update: not_applicable
        restricted_namespaces:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Restricted Namespaces
          description: Nodes inheriting from this Generic schema must belong to one of the listed namespaces
          update: allowed
        kind:
          anyOf:
          - type: string
          - type: 'null'
          title: Kind
        hash:
          type: string
          title: Hash
      additionalProperties: false
      type: object
      required:
      - name
      - namespace
      - hash
      title: APIGenericSchema
    HashableModelState:
      type: string
      enum:
      - present
      - absent
      title: HashableModelState
    GenericSchema:
      properties:
        id:
          anyOf:
          - type: string
          - type: 'null'
          title: Id
          description: The ID of the node
          update: not_applicable
        state:
          $ref: '#/components/schemas/HashableModelState'
          description: Expected state of the node/generic after loading the schema
          default: present
          update: not_applicable
        name:
          type: string
          maxLength: 32
          minLength: 2
          pattern: ^[A-Z][a-zA-Z0-9]+$
          title: Name
          description: Node name, must be unique within a namespace and must start with an uppercase letter.
          update: migration_required
        namespace:
          type: string
          maxLength: 64
          minLength: 3
          pattern: ^[A-Z][a-z0-9]+$
          title: Namespace
          description: Node Namespace, Namespaces are used to organize models into logical groups and to prevent name collisions.
          update: migration_required
        description:
          anyOf:
          - type: string
            maxLength: 128
          - type: 'null'
          title: Description
          description: Short description of the model, will be visible in the frontend.
          update: allowed
        label:
          anyOf:
          - type: string
            maxLength: 64
          - type: 'null'
          title: Label
          description: Human friendly representation of the name/kind
          update: allowed
        branch:
          $ref: '#/components/schemas/BranchSupportType'
          description: Type of branch support for the model.
          default: aware
          update: not_supported
        default_filter:
          anyOf:
          - type: string
            pattern: ^[a-z0-9\_]*$
          - type: 'null'
          title: Default Filter
          description: 'Default filter used to search for a node in addition to its ID. (deprecated: please use human_friendly_id instead)'
          update: allowed
        human_friendly_id:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Human Friendly Id
          description: Human friendly and unique identifier for the object.
          update: allowed
        display_label:
          anyOf:
          - type: string
          - type: 'null'
          title: Display Label
          description: Attribute or Jinja2 template to use to generate the display label
          update: allowed
        display_labels:
          anyOf:
          - items:
              type: string
              deprecationMessage: display_labels are deprecated use display_label instead
            type: array
          - type: 'null'
          title: Display Labels
          description: List of attributes to use to generate the display label (deprecated)
          update: allowed
        include_in_menu:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Include In Menu
          description: Defines if objects of this kind should be included in the menu.
          update: allowed
        menu_placement:
          anyOf:
          - type: string
          - type: 'null'
          title: Menu Placement
          description: Defines where in the menu this object should be placed.
          update: allowed
        icon:
          anyOf:
          - type: string
          - type: 'null'
          title: Icon
          description: Defines the icon to use in the menu. Must be a valid value from the MDI library https://icon-sets.iconify.design/mdi/
          update: allowed
        order_by:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Order By
          description: List of entries to order results by. Supports attributes, relationship attributes, and node_metadata with __asc/__desc.
          update: allowed
        uniqueness_constraints:
          anyOf:
          - items:
              items:
                type: string
              type: array
            type: array
          - type: 'null'
          title: Uniqueness Constraints
          description: List of multi-element uniqueness constraints that can combine relationships and attributes
          update: migration_required
        documentation:
          anyOf:
          - type: string
          - type: 'null'
          title: Documentation
          description: Link to a documentation associated with this object, can be internal or external.
          update: allowed
        attributes:
          items:
            $ref: '#/components/schemas/AttributeSchema-Input'
          type: array
          title: Attributes
          description: Node attributes
          update: not_applicable
        relationships:
          items:
            $ref: '#/components/schemas/RelationshipSchema'
          type: array
          title: Relationships
          description: Node Relationships
          update: not_applicable
        hierarchical:
          type: boolean
          title: Hierarchical
          description: Defines if the Generic support the hierarchical mode.
          default: false
          update: validate_constraint
        generate_profile:
          type: boolean
          title: Generate Profile
          description: Indicate if a profile schema should be generated for this schema
          default: true
          update: validate_constraint
        used_by:
          items:
            type: string
          type: array
          title: Used By
          description: List of Nodes that are referencing this Generic
          update: not_applicable
        restricted_namespaces:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Restricted Namespaces
          description: Nodes inheriting from this Generic schema must belong to one of the listed namespaces
          update: allowed
      additionalProperties: false
      type: object
      required:
      - name
      - namespace
      title: GenericSchema
      description: A Generic can be either an Interface or a Union depending if there are some Attributes or Relationships defined.
    APINodeSchema:
      properties:
        id:
          anyOf:
          - type: string
          - type: 'null'
          title: Id
          description: The ID of the node
          update: not_applicable
        state:
          $ref: '#/components/schemas/HashableModelState'
          description: Expected state of the node/generic after loading the schema
          default: present
          update: not_applicable
        name:
          type: string
          maxLength: 32
          minLength: 2
          pattern: ^[A-Z][a-zA-Z0-9]+$
          title: Name
          description: Node name, must be unique within a namespace and must start with an uppercase letter.
          update: migration_required
        namespace:
          type: string
          maxLength: 64
          minLength: 3
          pattern: ^[A-Z][a-z0-9]+$
          title: Namespace
          description: Node Namespace, Namespaces are used to organize models into logical groups and to prevent name collisions.
          update: migration_required
        description:
          anyOf:
          - type: string
            maxLength: 128
          - type: 'null'
          title: Description
          description: Short description of the model, will be visible in the frontend.
          update: allowed
        label:
          anyOf:
          - type: string
            maxLength: 64
          - type: 'null'
          title: Label
          description: Human friendly representation of the name/kind
          update: allowed
        branch:
          $ref: '#/components/schemas/BranchSupportType'
          description: Type of branch support for the model.
          default: aware
          update: not_supported
        default_filter:
          anyOf:
          - type: string
            pattern: ^[a-z0-9\_]*$
          - type: 'null'
          title: Default Filter
          description: 'Default filter used to search for a node in addition to its ID. (deprecated: please use human_friendly_id instead)'
          update: allowed
        human_friendly_id:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Human Friendly Id
          description: Human friendly and unique identifier for the object.
          update: allowed
        display_label:
          anyOf:
          - type: string
          - type: 'null'
          title: Display Label
          description: Attribute or Jinja2 template to use to generate the display label
          update: allowed
        display_labels:
          anyOf:
          - items:
              type: string
              deprecationMessage: display_labels are deprecated use display_label instead
            type: array
          - type: 'null'
          title: Display Labels
          description: List of attributes to use to generate the display label (deprecated)
          update: allowed
        include_in_menu:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Include In Menu
          description: Defines if objects of this kind should be included in the menu.
          update: allowed
        menu_placement:
          anyOf:
          - type: string
          - type: 'null'
          title: Menu Placement
          description: Defines where in the menu this object should be placed.
          update: allowed
        icon:
          anyOf:
          - type: string
          - type: 'null'
          title: Icon
          description: Defines the icon to use in the menu. Must be a valid value from the MDI library https://icon-sets.iconify.design/mdi/
          update: allowed
        order_by:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Order By
          description: List of entries to order results by. Supports attributes, relationship attributes, and node_metadata with __asc/__desc.
          update: allowed
        uniqueness_constraints:
          anyOf:
          - items:
              items:
                type: string
              type: array
            type: array
          - type: 'null'
          title: Uniqueness Constraints
          description: List of multi-element uniqueness constraints that can combine relationships and attributes
          update: migration_required
        documentation:
          anyOf:
          - type: string
          - type: 'null'
          title: Documentation
          description: Link to a documentation associated with this object, can be internal or external.
          update: allowed
        attributes:
          items:
            $ref: '#/components/schemas/AttributeSchema-Output'
          type: array
          title: Attributes
          description: Node attributes
          update: not_applicable
        relationships:
          items:
            $ref: '#/components/schemas/RelationshipSchema'
          type: array
          title: Relationships
          description: Node Relationships
          update: not_applicable
        inherit_from:
          items:
            type: string
          type: array
          title: Inherit From
          description: List of Generic Kind that this node is inheriting from
          update: validate_constraint
        generate_profile:
          type: boolean
          title: Generate Profile
          description: Indicate if a profile schema should be generated for this schema
          default: true
          update: validate_constraint
        generate_template:
          type: boolean
          title: Generate Template
          description: Indicate if an object template schema should be generated for this schema
          default: false
          update: allowed
        hierarchy:
          anyOf:
          - type: string
          - type: 'null'
          title: Hierarchy
          description: Internal value to track the name of the Hierarchy, must match the name of a Generic supporting hierarchical mode
          update: validate_constraint
        parent:
          anyOf:
          - type: string
          - type: 'null'
          title: Parent
          description: Expected Kind for the parent node in a Hierarchy, default to the main generic defined if not defined.
          update: validate_constraint
        children:
          anyOf:
          - type: string
          - type: 'null'
          title: Children
          description: Expected Kind for the children nodes in a Hierarchy, default to the main generic defined if not defined.
          update: validate_constraint
        kind:
          anyOf:
          - type: string
          - type: 'null'
          title: Kind
        hash:
          type: string
          title: Hash
      additionalProperties: false
      type: object
      required:
      - name
      - namespace
      - hash
      title: APINodeSchema
    JSONSchema:
      properties:
        title:
          anyOf:
          - type: string
          - type: 'null'
          title: Title
          description: Title of the schema
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          description: Description of the schema
        type:
          type: string
          title: Type
          description: Type of the schema element (e.g., 'object', 'array', 'string')
        properties:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Properties
          description: Properties of the object if type is 'object'
        items:
          anyOf:
          - additionalProperties: true
            type: object
          - items:
              additionalProperties: true
              type: object
            type: array
          - type: 'null'
          title: Items
          description: Items of the array if type is 'array'
        required:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Required
          description: List of required properties if type is 'object'
        $schema:
          anyOf:
          - type: string
          - type: 'null'
          title: $Schema
          description: Schema version identifier
        additionalProperties:
          anyOf:
          - type: boolean
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Additionalproperties
          description: Specifies whether additional properties are allowed
      type: object
      required:
      - type
      title: JSONSchema
    RelationshipSchema:
      properties:
        id:
          anyOf:
          - type: string
          - type: 'null'
          title: Id
          description: The ID of the relationship schema
          update: not_applicable
        state:
          $ref: '#/components/schemas/HashableModelState'
          description: Expected state of the relationship after loading the schema
          default: present
          update: not_applicable
        name:
          type: string
          maxLength: 64
          minLength: 3
          pattern: ^[a-z0-9\_]+$
          title: Name
          description: Relationship name, must be unique within a model and must be all lowercase.
          update: allowed
        peer:
          type: string
          pattern: ^[A-Z][a-zA-Z0-9]+$
          title: Peer
          description: Type (kind) of objects supported on the other end of the relationship.
          update: validate_constraint
        kind:
          $re

# --- truncated at 32 KB (78 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/opsmill/refs/heads/main/openapi/opsmill-schema-api-openapi.yml