Code Monkey home page Code Monkey logo

bjoernkw / spring-data-rest-json-schema-to-typescript-definitions Goto Github PK

View Code? Open in Web Editor NEW
8.0 4.0 0.0 44 KB

npm package that allows you to generate TypeScript definitions from JSON Schema metadata supplied by Spring Data REST endpoints.

Home Page: https://bjoernkw.github.io/spring-data-rest-json-schema-to-typescript-definitions/

License: Apache License 2.0

TypeScript 100.00%
npm-package npm-module npm-scripts typescript json-schema spring-data-rest java spring spring-data

spring-data-rest-json-schema-to-typescript-definitions's Introduction

spring-data-rest-json-schema-to-typescript-definitions

npm package that allows you to generate TypeScript declaration files from JSON Schema metadata supplied by Spring Data REST endpoints.

Getting Started

Installing

npm install spring-data-rest-json-schema-to-typescript-definitions --save-dev

Usage

Add a script named generate-model to your project's package.json, e.g.:

{
  ...
  "scripts": {
    ...
    "generate-model": "node node_modules/spring-data-rest-json-schema-to-typescript-definitions/dist/index.js http://localhost:8080 ./src/app/generated-model"
    ...
  },
  ...
}

The main index.js takes two arguments:

  1. The root URL of the API (http://localhost:8080 in the example above; the script automatically appends the /profile part to the URL) generated by Spring Data REST (see https://docs.spring.io/spring-data/rest/docs/current/reference/html/#metadata.json-schema for more information).
  2. The directory to which the TypeScript declaration files will be written (./src/app/generated-model in the example above).

Now you can generate TypeScript declaration files from your Spring Data REST endpoints by using this command from your project's root directory:

npm run generate-model

Built With

Authors

License

Apache License 2.0

Acknowledgements

Thanks to Boris Cherny whose json-schema-to-typescript package I could draw upon for creating this package.

spring-data-rest-json-schema-to-typescript-definitions's People

Contributors

bjoernkw avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  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.