Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/himenon/kubernetes-typescript-openapi
Implementation of TypeScript generated from Kubernetes OpenAPI
https://github.com/himenon/kubernetes-typescript-openapi
k8s kubernetes openapi swagger typescript
Last synced: about 1 month ago
JSON representation
Implementation of TypeScript generated from Kubernetes OpenAPI
- Host: GitHub
- URL: https://github.com/himenon/kubernetes-typescript-openapi
- Owner: Himenon
- License: mit
- Created: 2021-11-08T00:33:09.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-04T11:33:54.000Z (10 months ago)
- Last Synced: 2024-10-13T01:41:31.781Z (about 1 month ago)
- Topics: k8s, kubernetes, openapi, swagger, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@himenon/kubernetes-typescript-openapi
- Size: 3.66 MB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# @himenon/kubernetes-typescript-openapi
```bash
npm i @himenon/kubernetes-typescript-openapi
# or
pnpm i @himenon/kubernetes-typescript-openapi
# or
yarn add @himenon/kubernetes-typescript-openapi
```## Usage
```ts
import * as fs from "fs";
import * as yaml from "js-yaml"; // yarn add js-yaml @types/js-yaml
import type { Schemas } from "@himenon/kubernetes-typescript-openapi/dist/v1.29.1";const podTemplateSpec: Schemas.io$k8s$api$core$v1$PodTemplateSpec = {
metadata: {
labels: {
app: "nginx",
},
},
spec: {
containers: [
{
name: "nginx",
image: "nginx:1.14.2",
ports: [
{
containerPort: 80,
},
],
},
],
},
};const deployment: Schemas.io$k8s$api$apps$v1$Deployment = {
apiVersion: "apps/v1",
kind: "Deployment",
metadata: {
name: "nginx-deployment",
labels: {
app: "nginx",
},
},
spec: {
replicas: 3,
selector: {
matchLabels: {
app: "nginx",
},
},
template: podTemplateSpec,
},
};const text = yaml.dump(deployment, { noRefs: true, lineWidth: 144 });
fs.writeFileSync("deployment.yml", text, "utf-8");
```## Build
```ts
pnpm build
```## OpenAPI Source for Kubernetes
-
## OpenAPI TypeScript Code Generator
- [@himenon/openapi-typescript-code-generator](https://github.com/Himenon/openapi-typescript-code-generator)
You can also just use the type definition
## Use Another Version
Edit [config.ts](./scripts/config.ts)
## LICENCE
[@Himenon/kubernetes-typescript-openapi](https://github.com/Himenon/kubernetes-typescript-openapi)・MIT