Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codecentric/reedelk-openapi
OpenAPI v3 JSON/YAML serializer/deserializer
https://github.com/codecentric/reedelk-openapi
open-source openapi openapi-gen openapi-generator openapi-specification openapi3
Last synced: about 13 hours ago
JSON representation
OpenAPI v3 JSON/YAML serializer/deserializer
- Host: GitHub
- URL: https://github.com/codecentric/reedelk-openapi
- Owner: codecentric
- License: apache-2.0
- Created: 2020-07-28T08:25:55.000Z (over 4 years ago)
- Default Branch: develop
- Last Pushed: 2022-12-14T20:45:51.000Z (almost 2 years ago)
- Last Synced: 2024-11-14T14:10:15.803Z (3 days ago)
- Topics: open-source, openapi, openapi-gen, openapi-generator, openapi-specification, openapi3
- Language: Java
- Homepage: http://www.reedelk.com
- Size: 345 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Reedelk OpenAPI v3 serializer / deserializer
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/reedelk/reedelk-runtime/blob/master/LICENSE)
[![Twitter](https://img.shields.io/twitter/follow/reedelk.svg?style=social&label=Follow)](https://twitter.com/intent/follow?screen_name=reedelk)This project refers to the [OpenAPI Specification](https://github.com/OAI/OpenAPI-Specification) project from the [OpenAPI initiative](https://www.openapis.org/).
## Overview
The Reedelk OpenAPI v3.x serializer/deserializer library is a lightweight library to serialize/deserialize OpenAPI
v3.x model to/from JSON and to/from YAML.The library uses only [JSON-java (org.json)](https://github.com/stleary/JSON-java) and
[SnakeYAML](https://github.com/asomov/snakeyaml) as dependencies making it the perfect choice if you are just
looking for a very lightweight solution to serialize/deserialize OpenAPI v3.x definitions.
## Features- Serialize OpenAPI v3.x model to JSON
- Serialize OpenAPI v3.x model to YAML
- Deserialize OpenAPI v3.x model from JSON
- Deserialize OpenAPI v3.x model from YAML## Maven
Add the Reedelk Repository to your pom.xml:```xml
reedelk-repository
Reedelk Repository
http://repository.reedelk.com/release/
```
Add the following dependency to your pom.xml file:
```xmlcom.reedelk
reedelk-openapi
X.Y.Z```
## Usage
### Serialize
#### To JSON or YAML:
```java
InfoObject infoModel = new InfoObject();
infoModel.setDescription("This is a sample API.");
infoModel.setVersion("1.0.2");OpenApiObject openApiModel = new OpenApiObject();
openApiModel.setInfo(info);// to JSON string
String openApiAsJson = OpenApi.toJson(openApiModel);// to YAML string
String openApiAsYaml = OpenApi.toYaml(openApiModel);
```### Deserialize
#### From JSON or YAML:
```java
// from JSON string
String openApiAsJson = "{"openapi": "3.0.3","info": {"title": "API","version": "v1" }}";
OpenApiObject openApiModel = OpenApi.from(openApiAsJson);
InfoObject infoModel = actual.getInfo();
...// from YAML string
String openApiAsYaml = "openapi: 3.0.0
info:
version: 1.0.2
title: Petstore API";
OpenApiObject openApiModel = OpenApi.from(openApiAsYaml);
InfoObject infoModel = actual.getInfo();
...
```## Contribute
- If you find a bug in Reedelk OpenAPI, please [file a bug report](https://github.com/reedelk/reedelk-openapi/issues).
- If you want to discuss Reedelk OpenAPI, suggest new features, you have issues getting started with the library or just say 'Hi', let us know in the [Reedelk Slack Developers Community](https://join.slack.com/t/reedelk/shared_invite/zt-fz3wx56f-XDylXpqXERooKeOtrhdZug) [![Join Reedelk Slack Developers Community](https://img.shields.io/badge/Slack-Join%20the%20chat%20room-blue)](https://join.slack.com/t/reedelk/shared_invite/zt-fz3wx56f-XDylXpqXERooKeOtrhdZug).