Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
|
| - "$.components.schemas[?(!/^Error[0-9]{3}$/.test(@property))].properties[?(@.enum && @.enum.length > 1)].enum" | ||
| - "$.components.schemas[?(!/^Error[0-9]{3}$/.test(@property))].properties[?(@.items && @.items.enum && @.items.enum.length > 1)].items.enum" | ||
| - "$.components.schemas[?(!/^Error[0-9]{3}$/.test(@property))][allOf,oneOf,anyOf].*.properties[?(@.enum && @.enum.length > 1)].enum" | ||
| - "$.components.schemas[?(!/^Error[0-9]{3}$/.test(@property))][allOf,oneOf,anyOf].*.properties[?(@.items && @.items.enum && @.items.enum.length > 1)].items.enum" |
There was a problem hiding this comment.
The selectors miss enums inside a property's allOf, oneOf, or anyOf, nested objects, and array item objects. For example, properties.status.anyOf[0].enum: [PENDING, COMPLETED] matches none of these paths. Property-level compositions already appear in this repository, so contributors can use supported schema shapes and miss the promised lint error. Walk the nested schemas while leaving named component enums alone.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .spectral.yaml
Line: 115-118
Comment:
**Nested enums escape lint**
The selectors miss enums inside a property's `allOf`, `oneOf`, or `anyOf`, nested objects, and array item objects. For example, `properties.status.anyOf[0].enum: [PENDING, COMPLETED]` matches none of these paths. Property-level compositions already appear in this repository, so contributors can use supported schema shapes and miss the promised lint error. Walk the nested schemas while leaving named component enums alone.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| severity: error | ||
| resolved: false | ||
| given: | ||
| - "$.components.schemas[?(!/^Error[0-9]{3}$/.test(@property))].properties[?(@.enum && @.enum.length > 1)].enum" |
There was a problem hiding this comment.
The schema-name filter exempts every property of ErrorNNN, although the documented exception is only for code. A new multi-value enum on Error409.reason, for example, would pass this check without a lint error. Exclude the code paths rather than the entire error schemas.
Knowledge Base Used: Contract validation workflows
Prompt To Fix With AI
This is a comment left during a code review.
Path: .spectral.yaml
Line: 115
Comment:
**Error fields escape lint**
The schema-name filter exempts every property of `ErrorNNN`, although the documented exception is only for `code`. A new multi-value enum on `Error409.reason`, for example, would pass this check without a lint error. Exclude the `code` paths rather than the entire error schemas.
**Knowledge Base Used:** [Contract validation workflows](https://app.greptile.com/lightspark/-/custom-context/knowledge-base/lightsparkdev/grid-api/-/docs/contract-validation-workflows.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| - "$.components.schemas[?(!/^Error[0-9]{3}$/.test(@property))].properties[?(@.enum && @.enum.length > 1)].enum" | ||
| - "$.components.schemas[?(!/^Error[0-9]{3}$/.test(@property))].properties[?(@.items && @.items.enum && @.items.enum.length > 1)].items.enum" | ||
| - "$.components.schemas[?(!/^Error[0-9]{3}$/.test(@property))][allOf,oneOf,anyOf].*.properties[?(@.enum && @.enum.length > 1)].enum" | ||
| - "$.components.schemas[?(!/^Error[0-9]{3}$/.test(@property))][allOf,oneOf,anyOf].*.properties[?(@.items && @.items.enum && @.items.enum.length > 1)].items.enum" |
There was a problem hiding this comment.
no-inline-enums misses enums inside a property's allOf, oneOf, or anyOf. For example, properties.status.anyOf: [{type: string, enum: [PENDING, COMPLETED]}, {type: 'null'}] matches none of these selectors. Nested object properties and arrays of objects are also skipped.
These fields can pass lint despite the new naming rule. Walk nested schema definitions while leaving named enums and single-value tags allowed.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .spectral.yaml
Line: 115-118
Comment:
**Nested enums pass lint**
`no-inline-enums` misses enums inside a property's `allOf`, `oneOf`, or `anyOf`. For example, `properties.status.anyOf: [{type: string, enum: [PENDING, COMPLETED]}, {type: 'null'}]` matches none of these selectors. Nested object properties and arrays of objects are also skipped.
These fields can pass lint despite the new naming rule. Walk nested schema definitions while leaving named enums and single-value tags allowed.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| severity: error | ||
| resolved: false | ||
| given: | ||
| - "$.components.schemas[?(!/^Error[0-9]{3}$/.test(@property))].properties[?(@.enum && @.enum.length > 1)].enum" |
There was a problem hiding this comment.
The filter excludes every field of an ErrorNNN schema, although the documented exception is only for code. Adding a multi-value enum to another field, such as Error422.precheckErrors.items, would silently pass this check. Limit the exception to code rather than skipping the entire error schema.
Knowledge Base Used: Contract validation workflows
Prompt To Fix With AI
This is a comment left during a code review.
Path: .spectral.yaml
Line: 115
Comment:
**Error fields bypass the rule**
The filter excludes every field of an `ErrorNNN` schema, although the documented exception is only for `code`. Adding a multi-value enum to another field, such as `Error422.precheckErrors.items`, would silently pass this check. Limit the exception to `code` rather than skipping the entire error schema.
**Knowledge Base Used:** [Contract validation workflows](https://app.greptile.com/lightspark/-/custom-context/knowledge-base/lightsparkdev/grid-api/-/docs/contract-validation-workflows.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.…emas Adds the no-inline-enums Spectral rule. An enum declared inline on a property generates a plain string field in the SDKs; a component schema generates an enum type. Single-value enums stay inline because they are the discriminator tags on variant schemas, and ErrorNNN.code enums are excluded because SDKs surface error codes through their error type. Seven fields are exempted in the overrides block: four whose values cannot be UPPER_SNAKE_CASE, two that use null as an enum member, and one that is a two-value subset of another enum. The README documents the convention. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MYijrrgsrFLJZ5fkmC5XwJ
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
1eee396 to
351a4aa
Compare
Independent PR on
main, but it must merge after #1151, #1152, and #1155: the rule fails on every inline enum those PRs remove, so its lint check stays red until they land. On today'smainit reports 31 errors; with the three merged it reports 0.What changed
no-inline-enumsSpectral rule. It flags any enum with more than one value declared inline on a schema property, directly or insideallOf,oneOf, oranyOf, including arrayitems. Single-value enums are not flagged, because they are the discriminator tags on variant schemas that the README already requires.ErrorNNN.codeenums are excluded, since SDKs surface error codes through their error type.overridesblock, each with the reason:OwnershipVerifyRequest.signatureScheme,PasskeyAttestation.transports, and the two wallet operationoperationTypefields have values that cannot be UPPER_SNAKE_CASE;SandboxCardDisputeResponse.dispositionandTwoFactorResetStatus.enrollmentStatususenullas an enum member;BulkCustomerImportJobAccepted.statusis a two-value subset ofBulkCustomerImportJobStatus.openapi/README.mdwith the convention and a before/after example, which the rule's message links to.Why
The rule turns the convention the enum PRs established into a check, so a new inline enum fails
make lintinstead of generating another string-typed SDK field.Test plan
mainbundle: 31no-inline-enumserrors, all on fields the three open enum PRs convert.mainplus those three PRs: 0 errors, exit code 0 with--fail-severity=error.🤖 Generated with Claude Code
https://claude.ai/code/session_01MYijrrgsrFLJZ5fkmC5XwJ