使用Nest-Swagger Openapi生成嵌套对象
我想使用Nestjs/Swagger生成一个API文件,其中其中一个是对象。 在“组件/模式”部分下的结果中,我看到了我正确创建的所有模式,但是在“路径”部分下,我看到嵌套属性被提取和扁平。 即,而不是这个条目,
...
"optional": true,
"schema": { "$ref": "#/components/schemas/MySchema" }
我会为MySchema中的每个属性获得条目(并且与父架上的其他条目相同的级别。所以真的不好)。
无论如何,“ myschema”是在组件/模式中正确生成的,它只是在“路径”部分中没有自动引用。枚举,原语等会自动引用,因此我想我只需要一些调整即可。我需要做什么?
I want to generate an API file using nestjs/swagger, where one of the properties is an object.
In the result under the components/schemas section I see all schemas I created properly, but under the "paths" section I see that the nested properties are extracted and flattened.
i.e instead of this one entry
...
"optional": true,
"schema": { "$ref": "#/components/schemas/MySchema" }
I get entries for each of the properties in MySchema (and in the same level with other entries from the parent schema. so really not good).
Anyway, "MySchema" is generated properly in components/schemas, it's just not automatically referenced to in "paths" section. Enums, primitives etc. are automatically referenced, so I guess I just need some adjustments. what do I need to do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论