Austin Ziegler de745a4c61
Elixir: Improve generated API options docs (#13478)
While working with the Magento 2.4 API definition, there were several
issues found. The easiest to resolve is a documentation naming issue.
(The others will be raised for discussion.)

This is known to be an issue with query parameters, but may not be
limited to *just* query parameters.

In the event that a parameter is a mix of arrays and objects, the
template in the documentation for the API function was expanding out the
parameter name such that `foo[0]` would be turned into
`:foo_left_square_bracket0_right_square_bracket`, but the actual
parameter name was being left as `:foo[0]`, which meant that the
documentation did not reflect the actual parameter.

> Note: there are issues with the way that query parameters are put
> together in this sense, which is going to require substantially more
> work to resolve as well as discussion on how these options should be
> implemented, as what the Magento API requires may not be what is
> expected by a different server, and the nature of the input parameters
> is itself incorrect.
2022-09-26 11:34:44 +02:00
..
2022-09-25 00:10:30 +08:00

OpenapiPetstore

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: " \

Building

To install the required dependencies and to build the elixir project, run:

mix local.hex --force
mix do deps.get, compile

Installation

If available in Hex, the package can be installed by adding openapi_petstore to your list of dependencies in mix.exs:

def deps do
  [{:openapi_petstore, "~> 1.0.0"}]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/openapi_petstore.

Configuration

You can override the URL of your server (e.g. if you have a separate development and production server in your configuration files).

config :openapi_petstore, base_url: "http://petstore.swagger.io:80/v2"

Multiple clients for the same API with different URLs can be created passing different base_urls when calling OpenapiPetstore.Connection.new/1:

client = OpenapiPetstore.Connection.new(base_url: "http://petstore.swagger.io:80/v2")