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

nestjs-swagger-converter-cloud-endpoint

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nestjs-swagger-converter-cloud-endpoint

Convert OpenAPI V3 to Swagger V2 file compatible with GCP cloud endpoint

  • 1.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
270
increased by175.51%
Maintainers
1
Weekly downloads
 
Created
Source

nestjs-swager-converter-cloud-endpoint

Convert OpenAPI V3 to Swagger 2 file compatible with GCP cloud endpoint

How to use

This package is only for NestJS applications.
You will need to use it with the "@nestjs/swagger" module, following this documentation.

// in your main.ts
import { convertOpenAPIV3toV2, converterOptions, formatOptions } from "nestjs-swagger-converter-cloud-endpoint";

const convertionOptions: converterOptions = {
    format: formatOptions.yaml, // or formatOptions.json to write as json file
    gcpProject: 'my_gcp_project', // name of your GCP project
    folderPath: process.cwd(), // the folder path to write the spec
    applicationName: `my_application`,
    host: `${GCP_ENDPOINT_HOST}`, // the GCP endpoint hostname
    endpointTargetIp: `${GCP_ENDPOINT_TARGET_IP}`, // the GCP endpoint public ip
    securityName: 'my_security_name', // the name of the security section in the spec
    // authorizationUrl: '' if you want to manually set the oauth2 authorizationUrl
}

// build you swagger doc like described in the nestjs documentation
const swaggerDocument = new DocumentBuilder()
        .setTitle('my super API')
        .setDescription('my super API')
        .setVersion('1.0.0')
        .addServer('https://localhost:3000', 'local server') // mandatory or it would fail
        .build();

const document = SwaggerModule.createDocument(app, swaggerDocument);

// call the module with the document instance, it will write it to process.cwd()/my_application.yaml
await convertOpenAPIV3toV2(document, convertionOptions)

Keywords

FAQs

Package last updated on 10 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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