We are using App Services to access MongoDB. Currently, App service requires JSON schema but we have Graphql schema so we are converting it to JSON schema using GitHub - charlypoly/graphql-to-json-schema: GraphQL Schema to JSON Schema while we are deploying the converted JSON schema, we are getting the following error:
Here is our Graphql schema:
type Query {
user: User
}
type User {
name: String!
profile: Profile!
email: String!
role: Role!
}
type Profile {
name: String!
age: Int!
}
enum Role {
USER
ADMIN
}
Here is the converted JSON schema:
{
“$schema”: “http://json-schema.org/draft-06/schema#”,
“properties”: {
“Query”: {
“type”: “object”,
“properties”: {
“user”: {
“type”: “object”,
“properties”: {
“return”: {
“$ref”: “#/definitions/User”
},
“arguments”: {
“type”: “object”,
“properties”: { },
“required”:
}
},
“required”:
}
},
“required”:
}
},
“definitions”: {
“User”: {
“type”: “object”,
“properties”: {
“name”: {
“type”: “object”,
“properties”: {
“return”: {
“$ref”: “#/definitions/String”
},
“arguments”: {
“type”: “object”,
“properties”: { },
“required”:
}
},
“required”:
},
“profile”: {
“type”: “object”,
“properties”: {
“return”: {
“$ref”: “#/definitions/Profile”
},
“arguments”: {
“type”: “object”,
“properties”: { },
“required”:
}
},
“required”:
},
“email”: {
“type”: “object”,
“properties”: {
“return”: {
“$ref”: “#/definitions/String”
},
“arguments”: {
“type”: “object”,
“properties”: { },
“required”:
}
},
“required”:
},
“role”: {
“type”: “object”,
“properties”: {
“return”: {
“$ref”: “#/definitions/Role”
},
“arguments”: {
“type”: “object”,
“properties”: { },
“required”:
}
},
“required”:
}
},
“required”: [“name”, “profile”, “email”, “role”]
},
“String”: {
“type”: “string”,
“title”: “String”,
“description”: “The String
scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.”
},
“Profile”: {
“type”: “object”,
“properties”: {
“name”: {
“type”: “object”,
“properties”: {
“return”: {
“$ref”: “#/definitions/String”
},
“arguments”: {
“type”: “object”,
“properties”: { },
“required”:
}
},
“required”:
},
“age”: {
“type”: “object”,
“properties”: {
“return”: {
“$ref”: “#/definitions/Int”
},
“arguments”: {
“type”: “object”,
“properties”: { },
“required”:
}
},
“required”:
}
},
“required”: [“name”, “age”]
},
“Int”: {
“type”: “number”,
“title”: “Int”,
“description”: “The Int
scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.”
},
“Role”: {
“type”: “string”,
“anyOf”: [{
“enum”: [“USER”],
“title”: “USER”
}, {
“enum”: [“ADMIN”],
“title”: “ADMIN”
}]
},
“Boolean”: {
“type”: “boolean”,
“title”: “Boolean”,
“description”: “The Boolean
scalar type represents true
or false
.”
}
}
}
Can you help me to resolve it or provide the way to use Graphql schema for App Services?
Regards,
Raman Kumar