apollo-rs icon indicating copy to clipboard operation
apollo-rs copied to clipboard

semantic analysis: validate Input Values in Document

Open lrlna opened this issue 3 years ago • 0 comments

Description

Validate the operation definition and add related methods to the SourceDatabase.

Related Issues, #144, #147

Specification

The following separate Input Value types are to be validated in this issue:

  • [ ] String Value
  • [ ] List Value
  • [ ] Input Object Value
  • [ ] Variable
  • [ ] Named Type
  • [ ] Enum

String Value Validation

  • Documentation in spec

Semantic processing

String values have to be processed as per this breakdown in spec. While working on this issue, we ought to also figure out at what stage this processing happens (before or after validation), and whether or not this modification persists in the Source Database. The processing should definitely not modify the underlying AST.

List Value Validation

  • Documentation in spec

Semantic processing

String values have to be processed as per this breakdown in spec.

Input Value Object Validation

  • Documentation in spec

Semantic processing

String values have to be processed as per this breakdown in spec.

Variable Validation

  • Documentation in spec

1. Must not be defined as a constant to be used as an input value (e.g. is variable in scope?)

(spec)

Hints

  1. show where the variable is already defined as a constant

Additions to Source Database

  1. a notion of scope: what are current variables in a given operation definition? Vec<DefinedVariableNames>

2. Must be defined in top-level operation definition

Hints

  1. show where the variable can be added in top-level operation

Additions to Source Database

  1. current variables in use → Vec<VariablesInUse> (different than defined variables)

3. A variable must be defined by top level operation when in use by an operation's fragment

(spec)

Hints

  1. show where the variable can be added in top-level operation

Additions to Source Database

  1. a notion of scope: what are current variables in a given operation definition? Vec<DefinedVariableNames>

Named Type Validation

  • Documentation in spec

1. must be defined in schema

Additions to Source Database

  1. all scalars → Vec<ScalarTypeNames>
  2. all enums → Vec<EnumTypeNames>
  3. all objects → Vec<InputObjectTypeNames>

2. must not be null

lrlna avatar Jan 25 '22 18:01 lrlna