https://github.com/ironcore-dev/openapi-extractor
This project extracts the OpenAPI v2 and v3 specifications of a given Kubernetes API server
https://github.com/ironcore-dev/openapi-extractor
kube-apiserver kubernetes openapi openapi-spec openapi-specification openapi3 swagger
Last synced: 10 months ago
JSON representation
This project extracts the OpenAPI v2 and v3 specifications of a given Kubernetes API server
- Host: GitHub
- URL: https://github.com/ironcore-dev/openapi-extractor
- Owner: ironcore-dev
- License: apache-2.0
- Created: 2022-10-05T13:22:32.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-11T06:51:03.000Z (almost 2 years ago)
- Last Synced: 2024-04-14T02:53:32.079Z (almost 2 years ago)
- Topics: kube-apiserver, kubernetes, openapi, openapi-spec, openapi-specification, openapi3, swagger
- Language: Go
- Homepage:
- Size: 318 KB
- Stars: 3
- Watchers: 6
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# openapi-extractor
[](https://api.reuse.software/info/github.com/ironcore-dev/openapi-extractor)
[](https://goreportcard.com/report/github.com/ironcore-dev/openapi-extractor)
[](LICENSE)
[](https://makeapullrequest.com)
The `openapi-extractor` extracts the OpenAPI v2 and v3 specifications of a given Kubernetes API server.
## Installation
### From source
To install the `openapi-extractor` binary into your Go bin path run
```bash
go install github.com/ironcore-dev/openapi-extractor/cmd/openapi-extractor@main
```
## Usage
### Command based extraction
In case you have the api server binary present, you can extract the OpenAPI specifications by running
```shell
openapi-extractor --apiserver-command= \
--apiservices=
```
### Go module based extraction
The [`sample`](/sample) folder contains an example on how to extract the Open API spec from an api server package. In
our example we are using the [`ironcore`](https://github.com/ironcore-dev/ironcore) aggregated api server.
```shell
openapi-extractor --apiserver-package=github.com/ironcore-dev/ironcore/cmd/ironcore-apiserver \
--apiserver-build-opts=mod \
--apiservices=
```
In case you want to use your own package, first `go get` it so you have to correct dependencies in your `go.mod` file and
adjust the `--apiserver-package` flag accordingly.
### Output
The extracted OpenAPI v2 and v3 files can be found in current folder where the v2 version will be stored in the `swagger.json`
file and the v3 versions will be stored in individual files per group in the `./v3` folder.
To override the location of the output pass on the `--output` flag e.g. via `--output=dev` store extract the files into
the `./dev` folder.
## Contributing
We'd love to get feedback from you. Please report bugs, suggestions or post questions by opening a GitHub issue.
## License
Copyright 2022.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.