Skip to content

Conversation

BoD
Copy link
Contributor

@BoD BoD commented Nov 26, 2024

Adding multiple @link extensions was failing because the definition of @link wasn't known, so couldn't check if it's repeatable here.

@BoD BoD requested a review from martinbonnin as a code owner November 26, 2024 18:08
@svc-apollo-docs
Copy link
Collaborator

svc-apollo-docs commented Nov 26, 2024

✅ Docs Preview Ready

No new or changed pages found.

val minimalSchema = builtinDefinitions + linkDefinitions()
val minimalSchema = builtinDefinitions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have getImports return its own foreign schema for @link? @link is a very special case and I'd rather keep everything contained in getImports()

Copy link
Contributor

@martinbonnin martinbonnin Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something along these lines:

      if (gqlDirective.name == "link") {
        val linkForeignSchema = ForeignSchema("link", "v1.0", """
              directive @link(
                url: String!,  
                as: String,
                import: [Import],
                for: Purpose)
                repeatable on SCHEMA

              scalar Import

              enum Purpose {
                SECURITY
                EXECUTION
              }

            """.trimIndent().toGQLDocument().definitions
        )
        imports.add(
            Import(linkForeignSchema, linkForeignSchema.definitions, mapOf("link" to "link"))
        )

@BoD BoD merged commit bd67fda into main Nov 27, 2024
6 checks passed
@BoD BoD deleted the fix-multiple-link branch November 27, 2024 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants