schemadiff.changes.schema API documentation

# Module `schemadiff.changes.schema`

Expand source code

    from schemadiff.changes import Change, Criticality

    class SchemaChange(Change):
        criticality = Criticality.breaking('Changing a root type is a breaking change')

        def __init__(self, old_type, new_type):
            self.old_type = old_type
            self.new_type = new_type

        @property
        def path(self):
            return self.new_type

    class SchemaQueryTypeChanged(SchemaChange):

        @property
        def message(self):
            return f"Schema query root has changed from `{self.old_type}` to `{self.new_type}`"

    class SchemaMutationTypeChanged(SchemaChange):

        @property
        def message(self):
            return f"Schema mutation root has changed from `{self.old_type}` to `{self.new_type}`"

    class SchemaSubscriptionTypeChanged(SchemaChange):

        @property
        def message(self):
            return f"Schema subscription root has changed from `{self.old_type}` to `{self.new_type}`"

## Classes

`class SchemaChange (old_type, new_type)`

  Common interface of all schema changes

  This class offers the common operations and properties of all schema changes. You may use it as a type hint to get better suggestions in your editor of choice.

  Expand source code

      class SchemaChange(Change):
          criticality = Criticality.breaking('Changing a root type is a breaking change')

          def __init__(self, old_type, new_type):
              self.old_type = old_type
              self.new_type = new_type

          @property
          def path(self):
              return self.new_type

  ### Ancestors

  - Change
  - abc.ABC

  ### Subclasses

  - SchemaMutationTypeChanged
  - SchemaQueryTypeChanged
  - SchemaSubscriptionTypeChanged

  ### Class variables

  `var criticality : Criticality`

  ### Inherited members

  - `Change`:
    - `breaking`
    - `checksum`
    - `dangerous`
    - `message`
    - `path`
    - `restricted`
    - `safe`
    - `to_dict`
    - `to_json`
`class SchemaMutationTypeChanged (old_type, new_type)`

  Common interface of all schema changes

  This class offers the common operations and properties of all schema changes. You may use it as a type hint to get better suggestions in your editor of choice.

  Expand source code

      class SchemaMutationTypeChanged(SchemaChange):

          @property
          def message(self):
              return f"Schema mutation root has changed from `{self.old_type}` to `{self.new_type}`"

  ### Ancestors

  - SchemaChange
  - Change
  - abc.ABC

  ### Inherited members

  - `SchemaChange`:
    - `breaking`
    - `checksum`
    - `dangerous`
    - `message`
    - `path`
    - `restricted`
    - `safe`
    - `to_dict`
    - `to_json`
`class SchemaQueryTypeChanged (old_type, new_type)`

  Common interface of all schema changes

  This class offers the common operations and properties of all schema changes. You may use it as a type hint to get better suggestions in your editor of choice.

  Expand source code

      class SchemaQueryTypeChanged(SchemaChange):

          @property
          def message(self):
              return f"Schema query root has changed from `{self.old_type}` to `{self.new_type}`"

  ### Ancestors

  - SchemaChange
  - Change
  - abc.ABC

  ### Inherited members

  - `SchemaChange`:
    - `breaking`
    - `checksum`
    - `dangerous`
    - `message`
    - `path`
    - `restricted`
    - `safe`
    - `to_dict`
    - `to_json`
`class SchemaSubscriptionTypeChanged (old_type, new_type)`

  Common interface of all schema changes

  This class offers the common operations and properties of all schema changes. You may use it as a type hint to get better suggestions in your editor of choice.

  Expand source code

      class SchemaSubscriptionTypeChanged(SchemaChange):

          @property
          def message(self):
              return f"Schema subscription root has changed from `{self.old_type}` to `{self.new_type}`"

  ### Ancestors

  - SchemaChange
  - Change
  - abc.ABC

  ### Inherited members

  - `SchemaChange`:
    - `breaking`
    - `checksum`
    - `dangerous`
    - `message`
    - `path`
    - `restricted`
    - `safe`
    - `to_dict`
    - `to_json`