Skip to content

Tags: JuliaComputing/OpenAPI.jl

Tags

v0.1.27

[Diff since v0.1.26](v0.1.26...v0.1.27)

**Merged pull requests:**
- Handle binary response as `octet-stream` (#85) (@qiaojunfeng)
- fix: Vector{T} gets deserialized to Vector{Any} when empty (#86) (@vdayanand)

v0.1.26

[Diff since v0.1.25](v0.1.25...v0.1.26)

**Merged pull requests:**
- chore: add delay for docker tools, doc updates (#80) (@tanmaykm)
- feat: use native interrupt support in Downloads.jl (#82) (@tanmaykm)
- chore: re-enable julia nightly in ci (#83) (@tanmaykm)

**Closed issues:**
- Throwing InterruptException to download task not a good idea (#81)

v0.1.25

## OpenAPI v0.1.25

[Diff since v0.1.24](v0.1.24...v0.1.25)


**Merged pull requests:**
- feat: support for query parameter serialization style "deepObject" (#78) (@vdayanand)
- chore: update version for tagging (#79) (@tanmaykm)

v0.1.24

## OpenAPI v0.1.24

[Diff since v0.1.23](v0.1.23...v0.1.24)


**Merged pull requests:**
- feat: add validation related parameters to ValidationException (#76) (@vdayanand)
- Set version 0.1.24 (#77) (@vdayanand)

v0.1.23

## OpenAPI v0.1.23

[Diff since v0.1.22](v0.1.22...v0.1.23)


**Merged pull requests:**
- add tests for timeout handling (#74) (@tanmaykm)
- feat: add tool to generate code from spec (#75) (@tanmaykm)

v0.1.23+doc1

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
feat: add tool to generate code from spec (#75)

Add a few methods that help invoke the code generator providing a spec file and generating Julia code.

The [OpenAPI Generator Docker image](https://hub.docker.com/r/openapitools/openapi-generator-cli) is a code generator that can generate client libraries, server stubs, and API documentation from an OpenAPI Specification. It can also be hosted as a service. OpenAPI.jl will now make use of that to provide a way to generate code. Methos `OpenAPI.generate` will generate code from an OpenAPI specification. It can be pointed at a server hosted on the local machine or a remote server. The OpenAPI Generator must be running at the specified `generator_host`. Returns the folder containing generated code.

```julia
OpenAPI.generate(
    spec::Dict{String,Any};
    type::Symbol=:client,
    package_name::AbstractString="APIClient",
    export_models::Bool=false,
    export_operations::Bool=false,
    output_dir::AbstractString="",
    generator_host::AbstractString=GeneratorHost.Local
)
```

Arguments:
- `spec`: The OpenAPI specification as a Dict. It can be obtained by parsing a JSON or YAML file using `JSON.parse` or `YAML.load`.

Optional arguments:
- `type`: The type of code to generate. Must be `:client` or `:server`. Defaults to `:client`.
- `package_name`: The name of the package to generate. Defaults to "APIClient".
- `export_models`: Whether to export models. Defaults to false.
- `export_operations`: Whether to export operations. Defaults to false.
- `output_dir`: The directory to save the generated code. Defaults to a temporary directory. Directory will be created if it does not exist.
- `generator_host`: The host of the OpenAPI Generator. Defaults to `GeneratorHost.Local` (which points to `http://localhost:8080`).

The `generator_host` can be pointed to any other URL where the OpenAPI Generator is running, e.g. `https://openapigen.myorg.com`. Other possible pre-defined values of `generator_host`, which point to the public service hosted by OpenAPI org are:
- `OpenAPI.GeneratorHost.OpenAPIGeneratorTech.Stable`: Runs a stable version of the OpenAPI Generator at <https://api.openapi-generator.tech>.
- `OpenAPI.GeneratorHost.OpenAPIGeneratorTech.Master`: Runs the latest version of the OpenAPI Generator at <https://api-latest-master.openapi-generator.tech>.

A locally hosted generator service is preferred by default for privacy reasons. One can be started on the local machine using `OpenAPI.openapi_generator`. It uses the `openapitools/openapi-generator-online` docker image and requires docker engine to be installed. Use `OpenAPI.stop_openapi_generator` to stop the local generator service after use.

```julia
OpenAPI.openapi_generator(;
    port::Int=8080,         # port to use
    use_sudo::Bool=false    # whether to use sudo while invoking docker
)

OpenAPI.stop_openapi_generator(;
    use_sudo::Bool=false    # whether to use sudo while invoking docker
)
```

v0.1.22

## OpenAPI v0.1.22

[Diff since v0.1.21](v0.1.21...v0.1.22)


**Merged pull requests:**
- update github workflow (#66) (@tanmaykm)
- fix set_param (#68) (@jonalm)
- fix(ci): fix test code that caused ci freeze (#69) (@tanmaykm)
- chore: update patch version for tagging (#70) (@tanmaykm)

v0.1.21

## OpenAPI v0.1.21

[Diff since v0.1.20](v0.1.20...v0.1.21)


**Merged pull requests:**
- helper method to create HTTP response with code (#64) (@tanmaykm)

v0.1.21+doc1

## OpenAPI v0.1.21

[Diff since v0.1.20](v0.1.20...v0.1.21)


**Merged pull requests:**
- helper method to create HTTP response with code (#64) (@tanmaykm)

v0.1.20

## OpenAPI v0.1.20

[Diff since v0.1.19](v0.1.19...v0.1.20)


**Merged pull requests:**
- add missing convert method for AnyOfAPIModel (#62) (@tanmaykm)
- handle Any types that can hold vectors also (#63) (@tanmaykm)