View Source cowboy_swagger (cowboy_swagger v2.7.0)

cowboy-swagger main interface.

Link to this section Summary

Functions

Returns the swagger json specification from given trails. This function basically takes the metadata from each trails:trail() (which must be compliant with Swagger specification) and builds the required swagger.json.

Link to this section Types

-type metadata() :: trails:metadata(swagger_map()).
Link to this type

parameter_definition_name/0

View Source
-type parameter_definition_name() :: binary().
Link to this opaque

parameter_obj/0

View Source (opaque)
-opaque parameter_obj()
Link to this type

parameters_definition_array/0

View Source
-type parameters_definition_array() ::
    #{parameter_definition_name() =>
          #{type => binary(), items => #{type => binary(), properties => property_obj()}}}.
Link to this type

parameters_definitions/0

View Source
-type parameters_definitions() ::
    #{parameter_definition_name() => #{type => binary(), properties => property_obj(), _ => _}}.
-type property_desc() ::
    #{type => binary(), description => binary(), example => binary(), items => property_desc()}.
-type property_obj() :: #{binary() => property_desc()}.
Link to this opaque

response_obj/0

View Source (opaque)
-opaque response_obj()
Link to this type

responses_definitions/0

View Source
-type responses_definitions() :: #{binary() => response_obj()}.
-opaque swagger_map()
-type swagger_version() :: swagger_2_0 | openapi_3_0_0.

Link to this section Functions

Link to this function

add_definition(Definition)

View Source
-spec add_definition(Definition :: parameters_definitions() | parameters_definition_array()) -> ok.
Link to this function

add_definition(Name, Properties)

View Source
-spec add_definition(Name :: parameter_definition_name(), Properties :: property_obj()) -> ok.
Link to this function

add_definition_array(Name, Properties)

View Source
-spec add_definition_array(Name :: parameter_definition_name(), Properties :: property_obj()) -> ok.
Link to this function

get_existing_definitions(CurrentSpec, Type)

View Source
-spec get_existing_definitions(CurrentSpec :: jsx:json_term(), Type :: atom() | binary()) ->
                            Definition :: parameters_definitions() | parameters_definition_array().
-spec get_global_spec() -> jsx:json_term().
Link to this function

get_global_spec(Default)

View Source
-spec get_global_spec(jsx:json_term()) -> jsx:json_term().
-spec schema(DefinitionName :: parameter_definition_name()) -> #{<<_:32>> => <<_:64, _:_*8>>}.
Link to this function

set_global_spec(NewSpec)

View Source
-spec set_global_spec(jsx:json_term()) -> ok.
-spec to_json([trails:trail()]) -> jsx:json_text().
Returns the swagger json specification from given trails. This function basically takes the metadata from each trails:trail() (which must be compliant with Swagger specification) and builds the required swagger.json.