Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema validation: objects #228

Closed
ghostdogpr opened this issue Feb 22, 2020 · 1 comment · Fixed by #259
Closed

Schema validation: objects #228

ghostdogpr opened this issue Feb 22, 2020 · 1 comment · Fixed by #259
Labels
good first issue Good for newcomers server Issue related to caliban server

Comments

@ghostdogpr
Copy link
Owner

ghostdogpr commented Feb 22, 2020

In Validator.validateSchema, verify the rules for object types

  1. An Object type must define one or more fields.
  2. For each field of an Object type:
    1. The field must have a unique name within that Object type;
      no two fields may share the same name.
    2. The field must not have a name which begins with the
      characters {"__"} (two underscores).
    3. The field must return a type where {IsOutputType(fieldType)} returns {true}.
    4. For each argument of the field:
      1. The argument must not have a name which begins with the
        characters {"__"} (two underscores).
      2. The argument must accept a type where {IsInputType(argumentType)}
        returns {true}.
  3. An object type may declare that it implements one or more unique interfaces.
  4. An object type must be a super-set of all interfaces it implements:
    1. The object type must include a field of the same name for every field
      defined in an interface.
      1. The object field must be of a type which is equal to or a sub-type of
        the interface field (covariant).
        1. An object field type is a valid sub-type if it is equal to (the same
          type as) the interface field type.
        2. An object field type is a valid sub-type if it is an Object type and
          the interface field type is either an Interface type or a Union type
          and the object field type is a possible type of the interface field
          type.
        3. An object field type is a valid sub-type if it is a List type and
          the interface field type is also a List type and the list-item type
          of the object field type is a valid sub-type of the list-item type
          of the interface field type.
        4. An object field type is a valid sub-type if it is a Non-Null variant
          of a valid sub-type of the interface field type.
      2. The object field must include an argument of the same name for every
        argument defined in the interface field.
        1. The object field argument must accept the same type (invariant) as
          the interface field argument.
      3. The object field may include additional arguments not defined in the
        interface field, but any additional argument must not be required, e.g.
        must not be of a non-nullable type.
@zalbia
Copy link
Contributor

zalbia commented Feb 24, 2020

Working on this if someone isn't already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers server Issue related to caliban server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants