Skip to content

Expand path parameters for OpenAPI Typescript code generators

License

Notifications You must be signed in to change notification settings

HonoluluHenk/http-param-expander

Repository files navigation

http-param-expander

Make your life easier with HTTP parameter encoding for typescript/javascript projects!

Contributors Forks Stargazers Issues MIT License

CI NPM

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Changelog
  5. Roadmap
  6. Contributing
  7. License
  8. Contact
  9. Acknowledgments

About The Project

This Library aims to make your life easier with HTTP parameter encoding for typescript/javascript projects:

  • matrix parameters (mostly used by Java Jax-RS projects)
  • query parameters
  • form parameters
  • label parameters
  • simple parameters
  • and some more esoteric and custom parameter styles

Each in its exploded and flat form.

This is especially useful for REST-clients generated by OpenAPI generator where only a small subset of parameter styles is supported out of the box.

(back to top)

Getting Started

This npm library is intended to be used in typescript and javascript projects.

Just install the NPM package:

npm install @honoluluhenk/http-param-expander

(back to top)

Usage

import {MatrixParamExpander} from './matrix-param-expander';

const expander = new MatrixParamExpander();
const expanded = expander.expand({name: foo, value: {hello: 'world', bar: 'baz'}, exploded: true});
console.log(expanded);
// ;hello=world;bar=baz

Available expanders:

(back to top)

Changelog

See releases

(back to top)

Roadmap

  • Implement expander for deepObject style
  • Implement expander for spaceDelimited style
  • Implement expander for papeDelimited style

See the open issues for a full list of proposed features ( and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Run tests/linting (npm run prepush)
  5. Push to the Branch (git push origin feature/AmazingFeature)
  6. Open a Pull Request

(back to top)

License

Distributed under the Lesser Gnu Public License 2.1 (LGPL-2.1) License. See LICENSE for more information.

(back to top)

Contact

Christoph Linder - post@christoph-linder.ch

Project Link: https://github.com/HonoluluHenk/http-param-expander

(back to top)

Acknowledgments

(back to top)

About

Expand path parameters for OpenAPI Typescript code generators

Resources

License

Stars

Watchers

Forks

Packages

No packages published