Skip to content
This repository has been archived by the owner on Jul 13, 2018. It is now read-only.

A Swagger Codegen for JS compatible with React and React Native

License

Notifications You must be signed in to change notification settings

Ajk4/swagger-js-codegen

 
 

Repository files navigation

This project is not production-quality code.

I found two relevant projects on Github. First one generated API objects only. Second one generated only Models. And they did not work with React native.

I glued together those two projects adjusted them to work with react native. Because of this usage is a little bit awkward. I'm going to unify code in the future.

This is mostly for my use. But I'm sharing anyways - it might be usefull for some people.

Generating APIs

var fs = require('fs');
var CodeGen = require('swagger-js-react-native-codegen').CodeGen;

var file = './swagger-codegen/swagger.json';
var swagger = JSON.parse(fs.readFileSync(file, 'UTF-8'));
var nodejsSourceCode = CodeGen.getNodeCode({ className: 'Api', swagger: swagger });

fs.writeFile("./swagger-codegen/Api.js", nodejsSourceCode);

Generating models

Check swagger-codegen-models/README.md file

About

A Swagger Codegen for JS compatible with React and React Native

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 82.4%
  • HTML 17.6%