Is there a lib/tool for Python to automatically parse a graphqls file? If not, what is a good way to parse the file?
I have a Python project that is part of a larger Java project that contains a .graphqls
file with the enum
, input
, and type
definitions.
For example, the file has:
enum Version {
A
B
}
input ProjInput {
name: String!
term: String
version: Version
}
type ProjType {
name: String
term: String
version: Version
}
The file also contains the queries and mutations:
type Query {
queryProj(projName: String!): ProjType
}
type Mutation {
addProj(projInput: ProjInput): ProjType
}
I looked around but I can't find a tool to parse this data into a dict (or some other type) in Python. It would be nice to just do something like parsing json with json.loads()
.
Does such a lib/tool exist? And if not, how can I parse this file myself?
I can open and read the file, I am just not sure if just reading it line-by-line is a good method, or if I can automatically read enum
types, for example.