Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option graphQLSchemaPrefix to add constants prefix for each generated GraphQL schema #466

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Justinidlerz
Copy link

@Justinidlerz Justinidlerz commented Jun 17, 2022

Background:

I use the Apollo Federation to manage a GraphQL gateway.
And the histories Restful docs had many many conflict types, Such as Product, Order, Pagination
So I want to add a namespace for each transformed API

Changes

  • Add an option graphQLSchemaPrefix to add constants prefix for each generated GraphQL schema

In case, when passing the option graphQLSchemaPrefix such as: ModuleA,
And the API docs see like:

{
  "/products": {
    "post": {
      "responseBody": {
        "schema": {
          "$ref": "example.json"
        }
      },
      "requestBody": {
        "schema": {
          "type": "object",
          "properties": {
            "item": {
              "name": {
                "type": "String"
              }
            }
          }
        }
      }
    }
  }
}

The generated schema see like:

type ModuleAProduct {
   ...
}

type ModuleAProductInput {
   item: ModuleAItemInput
}

type ModuleAItemInput {
    name: String
}

Signed-off-by: Justinidlerz <zqc.sunny@gmail.com>
Signed-off-by: Justinidlerz <zqc.sunny@gmail.com>
Signed-off-by: Justinidlerz <zqc.sunny@gmail.com>
@Justinidlerz Justinidlerz changed the title Add a constants prefix for each generated GraphQL schema Add an option graphQLSchemaPrefix to add constants prefix for each generated GraphQL schema Jun 17, 2022
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.

None yet

1 participant