grantila / typeconv

Convert between JSON Schema, TypeScript, GraphQL, Open API and SureType
MIT License
421 stars 8 forks source link

[gql] `input` type is not getting converted #27

Open merlindru opened 2 years ago

merlindru commented 2 years ago

input types in GraphQL are not getting converted.

Example:

##### type.graphql #####

type Foo {
  bar: String!
}

##### input.graphql #####

input FooInput {
    bar: String!
}
$ typeconv -f gql -t ts ./type.graphql

💡 Converted 1 types in 1 files, in 0.0s

$ typeconv -f gql -t ts ./input.graphql

💡 Converted 0 types in 1 files, in 0.0s

# Note that I wrote this output myself and didn't actually test the two files above ;-)
# I did test the behavior with actual development/production use GraphQL schmas however
massfords commented 4 months ago

@grantila, This library looks great. I need support for transforming the input types for graphql as well. It looks like it would be a small change in the supporting core-types-graphql library to support input types. I see where [1] the visitor handles objects, unions, and enums. It just needs to be updated to support inputs.

Is this something you'd accept a PR for?

[1] https://github.com/grantila/core-types-graphql/blob/425f71f4a21e5f52a8c74011caace3b6c5538e76/lib/graphql-to-core-types.ts#L112