Andriy Dmytruk 09aa7bfd0a
Add support for Micronaut Client (#10063)
* Create initial version of openapi micronaut generator

* Update validation, authorization, query parameters and time format

* Move micronaut to its own generator

* Add micronaut documentation

* Refactor and add tests to JavaMicronautClientGenerator

* Refactor model mustache for micronaut client

* Refactor model enum and pojo mustache files for micronaut client

* Move micronaut client generation to micronaut 3.0.0-M5 version

* Generate samples for micronaut client

* Add hidden files of generated samples for micronaut client

* Add and configure micronaut tests as maven profile

* Add option to choose between junit and spock for micronaut client generator

* Add tests for micronaut 'build' and 'test' options; regenerate micronaut samples
2021-08-15 22:36:45 +08:00

3.2 KiB

StoreApi

All URIs are relative to http://petstore.swagger.io:80/v2

Method HTTP request Description
deleteOrder DELETE /store/order/{order_id} Delete purchase order by ID
getInventory GET /store/inventory Returns pet inventories by status
getOrderById GET /store/order/{order_id} Find purchase order by ID
placeOrder POST /store/order Place an order for a pet

Creating StoreApi

To initiate an instance of StoreApi, you can use micronaut's ApplicationContext:

/* imports
import io.micronaut.runtime.Micronaut;
import io.micronaut.context.ApplicationContext;
import org.openapitools.api.StoreApi;
*/

ApplicationContext context = Micronaut.run(/* ... */);
PetApi apiInstance = context.getBean(StoreApi.class);

Or the @Inject annotation:

@Singleton
class MyClass {
    @Inject
    StoreApi storeApi;

    /* ... use the injected variable */
}

Note that the class needs to be annotated with one of Micronaut's scope annotations like Singleton in order to be processed.

More information can be found inside Inversion of Control guide section.

deleteOrder

Mono<Void> StoreApi.deleteOrder(orderId)

Delete purchase order by ID

For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors

Parameters

Name Type Description Notes
orderId String ID of the order that needs to be deleted

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

getInventory

Mono<Map<String, Integer>> StoreApi.getInventory()

Returns pet inventories by status

Returns a map of status codes to quantities

Return type

Map&lt;String, Integer&gt;

Authorization

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getOrderById

Mono<Order> StoreApi.getOrderById(orderId)

Find purchase order by ID

For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions

Parameters

Name Type Description Notes
orderId Long ID of pet that needs to be fetched

Return type

Order

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/xml, application/json

placeOrder

Mono<Order> StoreApi.placeOrder(_body)

Place an order for a pet

Parameters

Name Type Description Notes
_body Order order placed for purchasing the pet

Return type

Order

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/xml, application/json