Skip to content

Latest commit

 

History

History
105 lines (59 loc) · 5.41 KB

usage.md

File metadata and controls

105 lines (59 loc) · 5.41 KB

Usages

Modelina can be used in many different contexts and has many features, all depending on the output language. This document will walk you through you the library's basic usages.

For more advanced use-cases, please check out the advanced document.

For more specific integration options, please check out the integration document.

Understanding the output format

TODO

Generate models from AsyncAPI documents

When providing an AsyncAPI document, the library iterates the entire document and generate models for all defined messages. If any other kind of iteration is wanted, feel free to create a feature request.

There are two ways to generate models for an AsyncAPI document.

The library expects the asyncapi property for the document to be set in order to understand the input format.

The message payloads, since it is a JSON Schema variant, is interpreted as a such.

Generate models from JSON Schema documents

There is one way to generate models for a JSON Schema document.

We support both draft-4, draft-6, and draft-7 documents.

The library expects the $schema property for the document to be set in order to understand the input format. By default, if no other inputs are detected, it defaults to JSON Schema draft 7. The process of interpreting a JSON Schema to a model can be read here.

Generate models from Swagger 2.0 documents

There are one way to generate models from a Swagger 2.0 document

The Swagger input processor expects that the property swagger is defined in order to know it should be processed.

The response payload and body parameters, since it is a JSON Schema variant, is interpreted as a such.

Generate models from OpenAPI documents

There are one way to generate models from an OpenAPI document

The OpenAPI input processor expects that the property openapi is defined in order to know it should be processed.

The response and request payloads, since it is a JSON Schema variant, is interpreted as a such.

Generate models from TypeScript type files

Currently, we support generating models from a TypeScript type file.

The TypeScript input processor expects that the typescript file and base directory where it's present, is passed as input, in order to process the types accurately.

Generate Go models

Go is one of the many output languages we support. Check out this basic example for a live demonstration and the following Go documentation for more advanced use-cases.

Generate C# models

C# is one of the many output languages we support. Check out this basic example for a live demonstration and the following C# documentation for more advanced use-cases.

Generate Java models

Java is one of the many output languages we support. Check out this basic example for a live demonstration and the following Java documentation for more advanced use-cases.

Generate TypeScript models

TypeScript is one of the many output languages we support. Check out this basic example for a live demonstration and the following TypeScript documentation for more advanced use-cases.

Generate JavaScript models

JavaScript is one of the many output languages we support. Check out this basic example for a live demonstration and the following JavaScript documentation for more advanced use-cases.

Generate Dart models

Dart is one of the many output languages we support. Check out this basic example for a live demonstration and the following Dart documentation for more advanced use-cases.