aws / aws/aws-appsync-community
AppSync schema creation fails when a # comment before an enum value contains the word "null"
- Dominant language
- HTML
- Stars
- 507
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Description
GraphQL SDL の enum 値直前の # コメントに null という単語が含まれていると、schema 作成が Failed to parse schema document - ensure it's a valid SDL-formatted document. で失敗します。
最小再現 schema:
type Query {
hello: String
}
enum TestEnum {
A
# null
B
}
再現手順:
aws appsync start-schema-creation --api-id --definition fileb://schema.graphql
aws appsync get-schema-creation-status --api-id
# => {"status": "FAILED", "details": "Failed to parse schema document - ..."}
確認済みの挙動
- enum 値直前のコメントに null / true / false が含まれると FAILED(# returns null value のように文中でも)
- 同じコメントでも null 等を含まなければ SUCCESS
- フィールド定義の直前の # null は SUCCESS → enum 値位置限定の不具合
- 参照実装 graphql-js は上記 schema をすべて正常にパースする
期待動作: GraphQL 仕様では # コメントは字句解析で無視される(ignored token)ため、内容によらず受理されるべき。
推定原因: コメントを直後の定義の説明文として取り込む処理が、enum 値位置でコメント内の boolean/null リテラルをトークンとして評価している。
補足(位置依存であることの証拠):
- 同じ null 入りコメントがフィールド定義の直前にある場合は正常に受理される(弊社の本番 schema に複数存在しデプロイ実績あり)
- enum 値の直前という位置に限って失敗する
- コメントを # 未設定 等に変更すると成功する
Contributor guide
Research direction
Start with the minimal schema in schema.graphql and reproduce the failure using aws appsync start-schema-creation, then check aws appsync get-schema-creation-status. Compare enum-value comments containing null, true, or false with field-definition comments and the graphql-js reference behavior. Done means valid GraphQL comments before enum values are accepted and schema creation succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, graphql
- Domain
- api, backend-api-design, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100