Repository navigation
Closed
Labels
enhancementNew feature or request
Description
I'm trying to migrate https://github.com/deepmap/oapi-codegen into libopenapi and I just need to implement one last functionality. Is it possible to render a document as a yaml/json with internalized external references so it would not have any external dependencies? kin-api has swagger.InternalizeRefs function for that (example usage). I was wondering if there's such a thing exist in libopenapi?
Example:
From
{
"openapi": "3.0.0",
"info": {},
"paths": {},
"components": {
"schemas": {
"Container": {
"properties": {
"object_a": {
"$ref": "./packageA/spec.yaml#/components/schemas/ObjectA"
},
"object_b": {
"$ref": "./packageB/spec.yaml#/components/schemas/ObjectB"
},
"object_c": {
"$ref": "./object_c.json"
}
}
}
}
}
}to
{
"components": {
"schemas": {
"Container": {
"properties": {
"object_a": {
"$ref": "#/components/schemas/ObjectA"
},
"object_b": {
"$ref": "#/components/schemas/ObjectB"
},
"object_c": {
"$ref": "#/components/schemas/object_c"
}
}
},
"ObjectA": {
"properties": {
"name": {
"type": "string"
},
"object_b": {
"$ref": "#/components/schemas/ObjectB"
}
}
},
"ObjectB": {
"properties": {
"name": {
"type": "string"
}
}
},
"object_c": {
"additionalProperties": true,
"type": "object"
}
}
},
"info": {
"title": "",
"version": ""
},
"openapi": "3.0.0",
"paths": {}
}Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
daveshanley commentedon Dec 18, 2023
Would this be the same request as this? - daveshanley/vacuum#368
It currently cannot do this at the moment. It CAN render inline, but it won't restructure the document to create a single spec. This would be a new feature. Seems like it would be very useful.
yozel commentedon Dec 21, 2023
I think that would be the same request, yes.
As a proof-of-concept, I created this: https://github.com/yozel/libopenapi-internalize
I used
index.Rolodexandindex.Index, but not low-level or high-level models since I couldn't find a way to properly use them. Let me know if you have suggestions so I can work on the idea/feature.daveshanley commentedon Jan 18, 2024
This feature is coming in the next release of libopenapi.
daveshanley commentedon Jan 18, 2024
This feature is now available in
v0.15.0https://pb33f.io/libopenapi/bundling/