Releases: pb33f/libopenapi
v0.10.3
Added Render
method to document
Previously RenderAndReload
was the only way to print out the document as a byte slice, and then have a new model created from that rendered document.
A use-case has appeared, where a non-destructive approach is required for high-level use where a render is needed, but any manipulation of the model will cause issues.
So a new Render
method has been added, that does everything RenderAndReload
does, except it does not reload.
WARNING
The high and low level models will remain out of sync after rendering. This is totally fine if you don't use the low level model, but if you do, then remember that the render is of the mutated high-level and the low-level will not match, it will reference the original document, before mutation.
Added `const` to `Schema`
v0.10.1
New mock/example renderer is now available for all v3
base.Schema
entities and any other high level object that contains Examples
or Example
or a Schema
/ SchemaProxy
Based on PR #162
Here is an example of how to use it.
// create a new YAML mock generator
mg := NewMockGenerator(JSON)
burgerShop, _ := os.ReadFile("../test_specs/burgershop.openapi.yaml")
// create a new document from specification and build a v3 model.
document, _ := libopenapi.NewDocument(burgerShop)
v3Model, _ := document.BuildV3Model()
// create a mock of the Fries model
friesModel := v3Model.Model.Components.Schemas["Fries"]
fries := friesModel.Schema()
mock, err := mg.GenerateMock(fries, "")
if err != nil {
panic(err)
}
fmt.Println(string(mock))
// Output: {"favoriteDrink":{"drinkType":"coke","size":"M"},"potatoShape":"Crispy Shoestring"}
Documentation is coming soon to https://quobix.com/vacuum/
v0.10.0
Low-level schemas now have access to the key node, which was missing before.
This is a breaking change with some low-level APIs, which is why the minor version bump.
Authored by @bitomaxsp
v0.9.9
GetAllSchemas()
from the index now picks up a lot more previously disregarded schemas throughout the document(s).
v0.9.8
Adds a new GetAllReferenceSchemas
method to the index that allows any schema defined by a $ref to be picked up. And then this new set of discoveries is now rolled up into GetAllSchemas
It also fixes a minor bug with hashing nil values.
No breaking changes, no new features.
v0.9.7
Minor bugfix for ensuring low-level nodes are ignored when being rendered. no breaking changes, no new features.
v0.9.5
v0.9.4
Adds more support for complex example type checking in what-changed.
No new features.