WardrikRest.Discovery.Schema (wardrik_rest v0.1.0-rc.1)

Copy Markdown

Turns Discovery schemas into JSON Schema types for WardrikRest.Spec.

A reference to another schema stays a reference, as %{"$ref" => "Campaign"}, by the schema's short name: a prefix ending in __, as Google Ads' GoogleAdsGoogleadsV24Resources__, is dropped where the rest is still unique. Fields the API only returns are left out, and so are the UNSPECIFIED and UNKNOWN values Google gives its enums, which no request may send.

Summary

Functions

Returns the fields of the request body request refers to, each with its JSON Schema, leaving out fields the API only returns. names are the schemas' short names.

Returns the short name of each schema of schemas, by its name in the document.

Returns the JSON Schema of a method's parameter, with its description.

Returns every schema of schemas as a JSON Schema type, by its short name.

Functions

fields(map, schemas, names)

@spec fields(map(), map(), map()) :: [{String.t(), map()}]

Returns the fields of the request body request refers to, each with its JSON Schema, leaving out fields the API only returns. names are the schemas' short names.

names(schemas)

@spec names(map()) :: %{required(String.t()) => String.t()}

Returns the short name of each schema of schemas, by its name in the document.

parameter(param)

@spec parameter(map()) :: map()

Returns the JSON Schema of a method's parameter, with its description.

types(schemas)

@spec types(map()) :: %{required(String.t()) => map()}

Returns every schema of schemas as a JSON Schema type, by its short name.