@honoluluhenk/http-param-expander
v1.0.1
Published
Expand parameters in headers,parameters,forms,matrix,... for OpenAPI Typescript code generators
Downloads
6
Maintainers
Readme
http-param-expander
Make your life easier with HTTP parameter encoding for typescript/javascript projects!
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.
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
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:
- FormParamExpander
- LabelParamExpander
- MatrixParamExpander
- SimpleParamExpander
- FormParamExpander (delegates to one of the above)
Changelog
See releases
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).
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!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Distributed under the Lesser Gnu Public License 2.1 (LGPL-2.1) License. See LICENSE
for more information.
Contact
Christoph Linder - [email protected]
Project Link: https://github.com/HonoluluHenk/http-param-expander
Acknowledgments
- The OpenAPI Initiative Project for their specifications and good generator tools