Repository navigation
Support for 'definitions' in json-schema聽#675
Description
Activity
@mikaelkaron as for now I'm taking the first approach, and I see a few caveats here:
If we have both 'properties' and 'definitions' in json-schema - we need to merge them, in usual cases that's not a problem, but I can see a case like that, where one of the properties refers to the definition on top-lvl:
"address": { "$id": "/schemas/address", "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "street_address": { "type": "string" }, "city": { "type": "string" }, "state": { "$ref": "#/definitions/state" } }, "required": ["street_address", "city", "state"], "definitions": { "state": { "enum": ["CA", "NY", "... etc ..."] } } }So we need some type of a merging strategy?
Finished the fixes for openapi, seems to work fine. Definitions are now being merged with properties at transformDefsToComponents helper, solutions is kind of hacky, but I don't really see any other choices here
I was thinking about case that I mentioned earlier at #675 (comment), but it looks like we also lack support for a relative path which was the issue in #612, so I guess we can't do better yet
@mcollina would appreciate if you can take a look at #676, so I can proceed further with the swagger part if everything seems fine
- linked a pull request that will close this issuefeat: support local reference in schema, support definitions keyword #676
on Oct 18, 2022 When will this get merged?
I'm using
prisma-json-schema-generatorto generate a json schema from my prisma file, but this file has definitions in it and at the current time this completely breaks this plugin.Reacted by Melroy van den Berg, Navalex and Pablo FloresWhen will this get merged?
I'm using
prisma-json-schema-generatorto generate a json schema from my prisma file, but this file has definitions in it and at the current time this completely breaks this plugin.I also hope the related PR will be merged rather sooner than later. Fastify Swagger is lagging behind the industry standards.
When will this get merged?
I'm using
prisma-json-schema-generatorto generate a json schema from my prisma file, but this file has definitions in it and at the current time this completely breaks this plugin.Exactly same issue here, since I needed a clean way to reference my prisma schema for almost all my endpoints, I guess I'll make a little script to try migrate those definitions to components for the moment. Did you found any workaround on your side ?
- marked referencing #/components/schema when they don't exist #780 as a duplicate of this issue
on Sep 10, 2026 Closing as a duplicate of #639: both issues cover the same problem (the definitions keyword being stripped from schemas), and this one originated from a comment in that thread. Let's keep the discussion and any fix in #639, which is already labeled bug / good first issue. Feel free to add anything missing there.
Reacted by Melroy van den Berg
Prerequisites
馃殌 Feature Proposal
#639 (comment)
Motivation
Addressing the issue in #639
Example
No response