feat(materials): add OPENAPI_SPEC, ASYNCAPI_SPEC, GRAPHQL_SPEC material types#3085
Merged
javirln merged 3 commits intochainloop-dev:mainfrom May 4, 2026
Conversation
…al types Add three new material types for Web API design validation (PSF-20-25). OpenAPI and AsyncAPI crafters validate specs against embedded JSON Schemas (with cascade version detection and noStrictValidation support). GraphQL crafter parses SDL using gqlparser. All three extract metadata annotations and support both JSON and YAML formats where applicable. Assisted-by: Claude Code Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
There was a problem hiding this comment.
6 issues found across 42 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="internal/schemavalidators/external_schemas/openapi/openapi-3.1.schema.json">
<violation number="1" location="internal/schemavalidators/external_schemas/openapi/openapi-3.1.schema.json:967">
P1: The Link Object schema uses `body` instead of the OpenAPI-defined `server` property, causing incorrect validation behavior.</violation>
</file>
<file name="pkg/attestation/crafter/materials/asyncapi.go">
<violation number="1" location="pkg/attestation/crafter/materials/asyncapi.go:127">
P2: Selecting the first protocol from a map is non-deterministic; the annotated protocol can change between runs for the same AsyncAPI document.</violation>
</file>
<file name="pkg/attestation/crafter/materials/openapi.go">
<violation number="1" location="pkg/attestation/crafter/materials/openapi.go:108">
P2: `injectAnnotations` overwrites existing material annotations, removing metadata set earlier (such as `chainloop.material.size`).</violation>
</file>
<file name="pkg/attestation/crafter/materials/graphql_test.go">
<violation number="1" location="pkg/attestation/crafter/materials/graphql_test.go:115">
P2: Assertions in subtests are bound to the parent `*testing.T`; create assertion helpers per subtest (or pass `t` directly) so failures are attributed to the correct case.</violation>
</file>
<file name="pkg/attestation/crafter/materials/graphql.go">
<violation number="1" location="pkg/attestation/crafter/materials/graphql.go:76">
P2: Do not reinitialize `m.Annotations` here; it clears metadata set earlier (e.g., material size).</violation>
</file>
<file name="internal/schemavalidators/external_schemas/openapi/openapi-3.0.schema.json">
<violation number="1" location="internal/schemavalidators/external_schemas/openapi/openapi-3.0.schema.json:421">
P2: Link schema is missing the requirement that at least one of `operationId` or `operationRef` must be present, so invalid Link objects can pass validation.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
… selection Fix injectAnnotations in OpenAPI and GraphQL crafters to not overwrite annotations set by uploadAndCraft (e.g. material size). Sort server names in AsyncAPI crafter before selecting protocol to ensure deterministic output across runs. Assisted-by: Claude Code Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Piskoo
previously approved these changes
May 4, 2026
… keys API spec title and version are content metadata, not tool metadata. Replace AnnotationToolNameKey/AnnotationToolVersionKey with dedicated chainloop.material.api.name and chainloop.material.api.spec_version annotation keys in OpenAPI and AsyncAPI crafters. Assisted-by: Claude Code Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
jiparis
approved these changes
May 4, 2026
Member
jiparis
left a comment
There was a problem hiding this comment.
looks good, thanks. check those Cubic reviews just in case.
Piskoo
approved these changes
May 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenAPI and AsyncAPI crafters validate specs against embedded JSON Schemas (with cascade version detection and noStrictValidation support). GraphQL crafter parses SDL using gqlparser. All three extract metadata annotations and support both JSON and YAML formats where applicable.