Code Monkey home page Code Monkey logo

odata2openapi's Introduction

OData to OpenAPI converter

This node module converts an existing OData metadata to OpenAPI format.

Install

Run npm install --save odata2openapi

Usage

Converting existing XML string

Use the parse and convert methods if you have the metadata as XML.

JavaScript

const { parse, convert } = require('odata2openapi');

// Get the OData metadata as a string.
const xml = '';

const options = {
  host: 'services.odata.org',
  path: '/V4/Northwind/Northwind.svc'
};

parse(xml)
  .then(service => convert(service.entitySets, options, service.version))
  .then(swagger => console.log(JSON.stringify(swagger, null, 2)))
  .catch(error => console.error(error))

TypeScript

import { parse, convert, Options } from 'odata2openapi';

const options: Options = {
  host: 'services.odata.org',
  path: '/V4/Northwind/Northwind.svc'
};

// Get the OData metadata as a string.
const xml = '';

parse(xml)
  .then(service => convert(service.entitySets, options, service.version))
  .then(swagger => console.log(JSON.stringify(swagger, null, 2)))
  .catch(error => console.error(error))

odata2openapi's People

Contributors

akorchev avatar chauey avatar enchev avatar jandej avatar jhorbulyk avatar larshp avatar mikeralphson avatar shulkaolka avatar sindhu-pvp avatar therealmitchconnors avatar uaarsen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.