Comments (13)
Available in 0.1.5!
from graphql-mesh.
We have an example for JSON Schema;
https://github.com/Urigo/graphql-mesh/tree/master/examples/json-schema-example
I tried an example and it worked.
Could you share the generated JSON Schema or share more details or a reproduction codesandbox something like this one?
https://codesandbox.io/s/github/Urigo/graphql-mesh/tree/master/examples/json-schema-example
from graphql-mesh.
@ardatan Thanks for the quick response!
Unfortunately, I don't think I can share the Schema, nor API because it is from work.
But I also tried to do something more simple using https://jsonplaceholder.typicode.com/
and was able to get it running. But, I fear the Schema is just too darn simple, eg. only one layer deep in terms of properties:
{
"type": "object",
"title": "Todo",
"description": "Fake todo",
"properties": {
"userId": {
"type": "integer"
},
"id": {
"type": "integer"
},
"title": {
"type": "string"
},
"completed": {
"type": "boolean"
}
}
}
My original Schema has nested properties, for example:
{
"type": "object",
"title": "Article",
"description": "some article",
"properties": {
...,
"mainImage": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"caption": {
"type": "string"
},
"height": {
"type": "integer"
},
"width": {
"type": "integer"
},
"imageSizes": {
"type": "object",
"properties": {
"thumbnail": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"height": {
"type": "integer"
},
"width": {
"type": "integer"
},
"links": {
"type": "array",
"items": [
{
"type": "object",
"properties": {
"href": {
"type": "string"
},
"rel": {
"type": "string"
}
}
}
]
}
}
},
"large": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"height": {
"type": "integer"
},
"width": {
"type": "integer"
},
"links": {
"type": "array",
"items": [
{
"type": "object",
"properties": {
"href": {
"type": "string"
},
"rel": {
"type": "string"
}
}
}
]
}
}
},
"fullSize": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"height": {
"type": "integer"
},
"width": {
"type": "integer"
},
"links": {
"type": "array",
"items": [
{
"type": "object",
"properties": {
"href": {
"type": "string"
},
"rel": {
"type": "string"
}
}
}
]
}
}
},
"medium": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"height": {
"type": "integer"
},
"width": {
"type": "integer"
},
"links": {
"type": "array",
"items": [
{
"type": "object",
"properties": {
"href": {
"type": "string"
},
"rel": {
"type": "string"
}
}
}
]
}
}
}
}
},
"attribution": {
"type": "string"
},
"links": {
"type": "array",
"items": [
{
"type": "object",
"properties": {
"href": {
"type": "string"
},
"rel": {
"type": "string"
}
}
}
]
}
}
}
}
...( more properties) ...
and some might be deeper.
Could this be the issue? Perhaps the nested properties don't need to be there?
from graphql-mesh.
I think this PR fixes the issue.
Could you try with the alpha version in this PR?
#263
from graphql-mesh.
Gave it a quick run... still doesn't seem to work.
from graphql-mesh.
@hamatoyogi I tried to reproduce it with the given details but it works well. Could you please help me to reproduce it?
https://codesandbox.io/s/twilight-bush-3uzrn?file=/.meshrc.yml
from graphql-mesh.
@ardatan Found what is breaking it...:
Basically, not having definitions for "type": "array"
eg, not having the items
defined.
Also, "type" : "null"
seems to break things.
https://codesandbox.io/s/objective-black-ifnr6?file=/mesh-schema/json-schemas/article.json
(for some reason I can't restart the start process while working on the sandbox, so I couldn't break it - maybe I just don't know how 🤷- broke it local machine)
Got it working for me, but defining the shape of the arrays
and changing the "null"
to "string"
.
Maybe there is some stuff that could be addressed or at least documented.
Thanks for the help, and I hope this helps you guys!
from graphql-mesh.
You can restart it like that. But it is fine I restarted it and caught the probleem. And I pushed another fix for that situation. Now we handle both null
and untyped array
s.
from graphql-mesh.
Awesome @ardatan !
from graphql-mesh.
@hamatoyogi Could you try and confirm it works on this alpha version?
0.1.5-alpha-cbc6867.0
from graphql-mesh.
@ardatan tried it out with the old JSON
(empty array defs and "null" defs) and it doesn't work with 0.1.5-alpha-cbc6867.0
from graphql-mesh.
In here, I have both empty arrays and null defs, and it works with 0.1.5-alpha-cbc6867.0
. Am I missing something?
https://codesandbox.io/s/damp-brook-l2s2v?file=/package.json
from graphql-mesh.
Might have been my bad... Tried again, and made sure all dependencies were aligned, files saved in VScode and all... Chalk it up to doing too many things at once 😅
Looks good @ardatan !
from graphql-mesh.
Related Issues (20)
- Cannot read properties of undefined (reading 'originalError') HOT 2
- uWebSockets.js version 20.35.0 is causing app startup issues HOT 1
- [Rename Transformer]: not all rules are applied to a single target when using mode 'bare'
- (transformer/rename): Results differ depending on which mode is being used HOT 1
- Receiving 401 without body does not throw an error HOT 4
- (transformer/rename): Scalar types can't be renamed when using mode 'bare'
- [openapi]: fallbackFormat is ignored
- [transformer/naming-convention]: data can't be resolved when using in 'bare' mode
- [transformer/naming-convention]: Default enum values for arguments are not renamed properly HOT 1
- @graphql-mesh/grpc: Invalid value used as weak map key HOT 4
- Postman-Handler/Loader: Postman-Collections as source HOT 5
- Troubles with connectionParams on subscriptions
- Filter out header params with the OpenAPI handler doesn't work. HOT 1
- OData MS Graph Type with name "GraphEntityInput" does not exists HOT 1
- Not all `operationHeaders` are forwarded
- Bun - 🔍 Resolving [1/1] error: no commit matching "semver:^20" found for "uWebSockets.js" (but repository exists)
- Generated enum values as numbers when using gRPC source
- Transform federation generates incorrect schema
- CORS regex origins work in Firefox but not Chromium-based browsers
- Custom Logger not found with mesh start
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-mesh.