OpenAPI is awesome (Indonesian: keren), so we created several utilities for working with it.
Bundle splitted Open API files into one file while trying to persist all their use of $ref
.
go run -mod=mod github.com/telkomindonesia/oapik/cmd/oapik bundle <path-to-main-spec> <path-to-generated-spec>
For testing the functionality, you can use spec inside testdata directory, which will produce file(s) similar to testoutput directory.
Create a new spec by picking operations from other specs. The main purpose was to derive an OpenAPI spec for a lean backend-for-frontends using OpenAPI spec of upstream services behind it. It introduces a new x-proxy
extension. It can also generate ready-to-use code which is inspired by (and utilize) oapi-codegen.
go run -mod=mod github.com/telkomindonesia/oapik/cmd/oapik proxy <path-to-proxy-spec> <path-to-generated-spec> [<path-to-generated-go-file>]
For testing the functionality, you can use specs inside testdata directory, which will produce file(s) similar to testoutput directory.
This utilities are still in a very early development stage. Current limitations includes but not restricted to:
- When bundling, all components on non-root files are required to be defined under
components
key accordingly.