Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

crdtoapi

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crdtoapi - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

.eslintrc.cjs

20

dist/index.js

@@ -26,5 +26,5 @@ #!/usr/bin/env node

program
.version("0.0.5")
.version("0.0.6")
.description("Convert CRDs to OpenAPI file")
.option("-i, --in <dir>", "Input directory path [Required]")
.option("-i, --in <dir>", "Input directory path - required")
.option("-o, --out <file>", "Output file name")

@@ -42,2 +42,6 @@ .option("-t, --title <text>", "Module title")

const options = program.opts();
if (!options.in) {
console.log("error: missing mandatory argument --in");
process.exit(1);
}
const licenses = {

@@ -71,3 +75,4 @@ "Apache-2.0": "http://www.apache.org/licenses/",

catch (error) {
console.error("Error occurr ed while reading input file", error);
console.log(`error occurr ed while reading input file (${error})`);
process.exit(1);
}

@@ -93,3 +98,4 @@ return schemas;

catch (error) {
console.error("Error occurr ed while reading the input directory", error);
console.log(`error occurr ed while reading the input directory (${error})`);
process.exit(1);
}

@@ -107,3 +113,3 @@ return schemas;

const out = {
openapi: "3.0.0",
openapi: "3.1.0",
info: {

@@ -131,6 +137,2 @@ description: options.description,

});
if (!options.in) {
console.error('Error: Input directory is required\n');
program.help();
}
createOpenAPIFile().then((outString) => {

@@ -137,0 +139,0 @@ if (options.out) {

{
"name": "crdtoapi",
"version": "0.0.6",
"version": "0.0.7",
"description": "CustomResourceDefinitions to OpensAPI",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/yaacov/crdtoapi",

# CustomResourceDefinitions to OpensAPI
crdtoapi is a tool that creates an OpenAPI definitions file from kubernetes CustomResourceDefinitions.
crdtoapi is a tool that creates an [OpenAPI](https://www.openapis.org/) definitions file from [kubernetes](https://kubernetes.io/) [CustomResourceDefinitions](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/).

@@ -10,9 +10,18 @@ ## Usage

``` bash
npm install -g crdtoapi
npm install --location=global crdtoapi
# add npm bin path to your PATH, or use full
# excutable path, e.g. $(npm bin)/crdtoapi
# excutable path, e.g. $(npm bin --location=global)/crdtoapi
crdtoapi --help
crdtoapi -i ./examples/forklift/ -o openapi.yaml
# create an OpenAPI file
crdtoapi -i ./examples/forklift/
# create an OpenAPI file using flags
crdtoapi -i ./examples/forklift/ -o openapi.yaml \
--title "Forklift API" \
--description "Migration toolkit for virtualization (Forklift) API definitions." \
--license "Apache-2.0" \
--apiVersion "2.4.0" \
--contactEmail "kubev2v-dev@redhat.com"
```

@@ -22,15 +31,8 @@

OpensAPI comunity provide many [tools](https://openapi.tools/), for example
`openapi-generator-cli` is a tool for auto code generation using OpenAPI definition files.
``` bash
# create an OpenAPI file
crdtoapi -i ./examples/forklift/ \
-o openapi.yaml \
-t "Forklift API" \
-d "Forklift migration toolkit API definitions." \
-l "Apache-2.0" \
--apiVersion "2.4.0" \
--contactEmail kubev2v-dev@redhat.com
# use openapi-generator-cli:
# npm i -g @openapitools/openapi-generator-cli
# npm i --location=global @openapitools/openapi-generator-cli
openapi-generator-cli generate -g typescript-fetch --skip-validate-spec -o generated -i openapi.yaml

@@ -37,0 +39,0 @@ ```

@@ -13,5 +13,5 @@ #!/usr/bin/env node

program
.version("0.0.6")
.version("0.0.7")
.description("Convert CRDs to OpenAPI file")
.option("-i, --in <dir>", "Input directory path [Required]")
.option("-i, --in <dir>", "Input directory path - required")
.option("-o, --out <file>", "Output file name")

@@ -31,2 +31,7 @@ .option("-t, --title <text>", "Module title")

if (!options.in) {
console.log("error: missing mandatory argument --in");
process.exit(1);
}
type License = "Apache-2.0" | "BSD-3" | "BSD-2" | "GPL-3.0" | "GPL-2.0" | "MIT" | "MPL" | "ISC";

@@ -83,3 +88,4 @@ type Schemas = { [id: string] : Record<string, unknown>; };

} catch (error) {
console.error("Error occurr ed while reading input file", error);
console.log(`error occurr ed while reading input file (${error})`);
process.exit(1);
}

@@ -109,3 +115,4 @@

} catch (error) {
console.error("Error occurr ed while reading the input directory", error);
console.log(`error occurr ed while reading the input directory (${error})`);
process.exit(1);
}

@@ -151,8 +158,2 @@

if (!options.in) {
console.error('Error: Input directory is required\n');
program.help();
}
createOpenAPIFile().then((outString) => {

@@ -159,0 +160,0 @@ if (options.out) {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc