Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

v2 improves params documentation #139

Merged
merged 41 commits into from
Apr 2, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
fd6b7e2
Adds python type info to inline param schema docs
spacether Mar 29, 2023
c7ba99b
Updates endpoint docs for param content schema input type
spacether Mar 29, 2023
9f1d060
Updates ref param endpoint docs
spacether Mar 29, 2023
0c94de9
Makes it clear that params are of type dict
spacether Mar 29, 2023
67bc9d0
Adds hppt status prefix to code, mentions server_index_info
spacether Mar 29, 2023
c4d1963
Removes trailing comma from accessed type
spacether Mar 29, 2023
7058180
Fixes enum descriptions
spacether Mar 29, 2023
99e5825
Fixes broken template references in api_configuration
spacether Mar 29, 2023
04abe25
Include python types in property input types with ref classes
spacether Mar 29, 2023
eaaadf2
Fixes input types for dict keys
spacether Mar 29, 2023
b214f11
Adds missing comma
spacether Mar 29, 2023
c612337
Adds new type hints for ref properties
spacether Mar 30, 2023
cfe5097
Updates new sig for array models with ref items
spacether Mar 30, 2023
c3ebb60
Adds body primitive types to endpoint inputs
spacether Mar 30, 2023
a160824
Adds missing commas
spacether Mar 30, 2023
7353001
Fixes endpoint doc links for inline request bodies
spacether Mar 30, 2023
62f630f
Fixes endpoint docs inline request body types
spacether Mar 30, 2023
24c2466
Adds request body type info when the request body is refed
spacether Mar 30, 2023
278a1a0
Endpoint reqest body docs adds type hints for ref request bodies
spacether Mar 30, 2023
a60ca86
Removes template _helper_operation_args_baseapi_wrapper
spacether Mar 30, 2023
9d17518
Removes template _helper_operation_args_operationid_wrapper
spacether Mar 30, 2023
c0f68e0
Removes _helper_operation_args_httpmethod_wrapper
spacether Mar 30, 2023
d8a5eae
Uses jsonPathPiece.snakeCase for response module names in operation r…
spacether Mar 30, 2023
39b6400
Adds getNonErrorResponses for the templates, removes unnecessare unions
spacether Mar 30, 2023
deb59de
Fixes endpoint doc link to api
spacether Mar 31, 2023
4485384
Removes recordUsage
spacether Mar 31, 2023
4e62265
Adds prefix to response bodies
spacether Mar 31, 2023
e58da21
Removes includeSuffix
spacether Mar 31, 2023
f7717f7
Improved request body docs describing body
spacether Mar 31, 2023
e1f6b82
Does not use union for response bodies if there is only one
spacether Mar 31, 2023
34d028e
Endpoint description updated, // TODO adjust this for 3.1.0
spacether Mar 31, 2023
27b6207
Uses getContentSchemas in operation reuqest body type hints
spacether Apr 1, 2023
817e31e
Reduces template indentation for request body
spacether Apr 1, 2023
dc68c25
operation request body type hints now on new lines
spacether Apr 1, 2023
11ec699
Improves operation body type hints, make them newlined
spacether Apr 1, 2023
72f2b4d
Updates getContentSchemas to return anyType schema early
spacether Apr 2, 2023
1de8016
Fixes response body type hint
spacether Apr 2, 2023
3148c0e
Removes unneeded union from response body doc
spacether Apr 2, 2023
f9f519c
Improves endpoint docs for ref request body body types
spacether Apr 2, 2023
ab5e7a8
Improves endpoint request body doc type hints, eliminates redundant t…
spacether Apr 2, 2023
bca7563
Samples updated
spacether Apr 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#eq types null}}dict, frozendict.frozendict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, {{else}}{{#each types}}{{#eq this "array"}}list, tuple, {{/eq}}{{#eq this "object"}}dict, frozendict.frozendict, {{/eq}}{{#eq this "null"}}None, {{/eq}}{{#eq this "string" }}{{#neq ../format "binary"}}str, {{/neq}}{{#eq ../format "date"}}datetime.date, {{/eq}}{{#eq ../format "date-time"}}datetime.datetime, {{/eq}}{{#eq ../format "uuid"}}uuid.UUID, {{/eq}}{{#eq ../format "binary"}}bytes, io.FileIO, io.BufferedReader, {{/eq}}{{/eq}}{{#eq this "integer"}}decimal.Decimal, int, {{/eq}}{{#eq this "number"}}decimal.Decimal, int, float, {{/eq}}{{#eq this "boolean"}}bool, {{/eq}}{{/each}}{{/eq}}
{{#eq types null}}dict, frozendict.frozendict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader{{else}}{{#each types}}{{#unless @first}}, {{/unless}}{{#eq this "array"}}list, tuple{{/eq}}{{#eq this "object"}}dict, frozendict.frozendict{{/eq}}{{#eq this "null"}}None{{/eq}}{{#eq this "string" }}{{#neq ../format "binary"}}str{{/neq}}{{#eq ../format "date"}}datetime.date{{/eq}}{{#eq ../format "date-time"}}datetime.datetime{{/eq}}{{#eq ../format "uuid"}}uuid.UUID{{/eq}}{{#eq ../format "binary"}}bytes, io.FileIO, io.BufferedReader{{/eq}}{{/eq}}{{#eq this "integer"}}decimal.Decimal, int{{/eq}}{{#eq this "number"}}decimal.Decimal, int, float{{/eq}}{{#eq this "boolean"}}bool{{/eq}}{{/each}}{{/eq}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#eq types null}}frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, io.FileIO, {{else}}{{#each types}}{{#eq this "array"}}tuple, {{/eq}}{{#eq this "object"}}frozendict.frozendict, {{/eq}}{{#eq this "null"}}NoneClass, {{/eq}}{{#eq this "string" }}{{#neq ../format "binary"}}str, {{/neq}}{{#eq ../format "binary"}}bytes, io.FileIO, {{/eq}}{{/eq}}{{#eq this "integer"}}decimal.Decimal, {{/eq}}{{#eq this "number"}}decimal.Decimal, {{/eq}}{{#eq this "boolean"}}BoolClass, {{/eq}}{{/each}}{{/eq}}
{{#eq types null}}frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, io.FileIO{{else}}{{#each types}}{{#unless @first}}, {{/unless}}{{#eq this "array"}}tuple{{/eq}}{{#eq this "object"}}frozendict.frozendict{{/eq}}{{#eq this "null"}}NoneClass{{/eq}}{{#eq this "string" }}{{#neq ../format "binary"}}str{{/neq}}{{#eq ../format "binary"}}bytes, io.FileIO{{/eq}}{{/eq}}{{#eq this "integer"}}decimal.Decimal{{/eq}}{{#eq this "number"}}decimal.Decimal{{/eq}}{{#eq this "boolean"}}BoolClass{{/eq}}{{/each}}{{/eq}}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def __new__(
{{#if refInfo.refClass}}
{{@key.original}}: typing.Union['{{> components/schemas/_helper_refclass_with_module }}', schemas.Unset] = schemas.unset,
{{else}}
{{@key.original}}: typing.Union[Schema_.Properties.{{jsonPathPiece.camelCase}}, {{> _helper_schema_python_types }}schemas.Unset] = schemas.unset,
{{@key.original}}: typing.Union[Schema_.Properties.{{jsonPathPiece.camelCase}}, {{> _helper_schema_python_types }}, schemas.Unset] = schemas.unset,
{{/if}}
{{/if}}
{{/each}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#unless refInfo.refClass}}{{#if enumValueToName}} must be one of [{{#each enumValueToName}}{{#eq @key.type "null"}}None{{/eq}}{{#eq @key.type "boolean"}}{{#if @key.value}}True{{else}}False{{/if}}{{/eq}}{{#eq @key.type "string"}}"{{{@key.value}}}"{{/eq}}{{#eq @key.type "number"}}{{{@key.value}}}{{/eq}}{{#eq @key.type "integer"}}{{{@key.value}}}{{/eq}}, {{/each}}]{{/if}}{{#if defaultValue}}{{#unless requiredProperties}} if omitted the {{defaultUser}} will use the default value of {{{defaultValue.value}}}{{/unless}}{{/if}}{{#eq format "uuid"}} value must be a uuid{{/eq}}{{#eq format "date"}} value must conform to RFC-3339 full-date YYYY-MM-DD{{/eq}}{{#eq format "date-time"}} value must conform to RFC-3339 date-time{{/eq}}{{#eq format "number"}} value must be numeric and storable in decimal.Decimal{{/eq}}{{#eq format "int32"}} value must be a 32 bit integer{{/eq}}{{#eq format "int64"}} value must be a 64 bit integer{{/eq}}{{#eq format "double"}} value must be a 64 bit float{{/eq}}{{#eq format "float"}} value must be a 32 bit float{{/eq}}{{/unless}}
{{#unless refInfo.refClass}}{{#if enumValueToName}} must be one of [{{#each enumValueToName}}{{#unless @first}}, {{/unless}}{{#eq @key.type "null"}}None{{/eq}}{{#eq @key.type "boolean"}}{{#if @key.value}}True{{else}}False{{/if}}{{/eq}}{{#eq @key.type "string"}}"{{{@key.value}}}"{{/eq}}{{#eq @key.type "number"}}{{{@key.value}}}{{/eq}}{{#eq @key.type "integer"}}{{{@key.value}}}{{/eq}}{{/each}}]{{/if}}{{#if defaultValue}}{{#unless requiredProperties}} if omitted the {{defaultUser}} will use the default value of {{{defaultValue.value}}}{{/unless}}{{/if}}{{#eq format "uuid"}} value must be a uuid{{/eq}}{{#eq format "date"}} value must conform to RFC-3339 full-date YYYY-MM-DD{{/eq}}{{#eq format "date-time"}} value must conform to RFC-3339 date-time{{/eq}}{{#eq format "number"}} value must be numeric and storable in decimal.Decimal{{/eq}}{{#eq format "int32"}} value must be a 32 bit integer{{/eq}}{{#eq format "int64"}} value must be a 64 bit integer{{/eq}}{{#eq format "double"}} value must be a 64 bit float{{/eq}}{{#eq format "float"}} value must be a 32 bit float{{/eq}}{{/unless}}
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ Input Type | Accessed Type | Description | Notes
Key | Input Type | Accessed Type | Description | Notes
------------ | ------------- | ------------- | ------------- | -------------
{{#each requiredProperties}}
**{{@key.original}}** | {{#if refInfo.refClass}}{{> components/schemas/_helper_refclass_partial }}{{else}}{{> _helper_schema_python_types }}{{/if}} | {{#if refInfo.refClass}}{{> components/schemas/_helper_refclass_partial }}{{else}}{{> components/_helper_schema_accessed_types }}{{#if isComplicated}}[properties.{{@key.camelCase}}](#{{> components/_helper_anchor_id identifierPieces=(append identifierPieces "properties" @key.anchorPiece) includeSuffix=true }}){{/if}}{{/if}} | {{#if description}}{{description}}{{/if}} |{{> components/schemas/_helper_notes_msg defaultUser="server" }}
**{{@key.original}}** | {{#if refInfo.refClass}}{{> components/schemas/_helper_refclass_partial }}{{#with getDeepestRef}}, {{> _helper_schema_python_types }}{{/with}}{{else}}{{> _helper_schema_python_types }}{{/if}} | {{#if refInfo.refClass}}{{> components/schemas/_helper_refclass_partial }}{{else}}{{#if isComplicated}}[properties.{{@key.camelCase}}](#{{> components/_helper_anchor_id identifierPieces=(append identifierPieces "properties" @key.anchorPiece) includeSuffix=true }}){{else}}{{> components/_helper_schema_accessed_types }}{{/if}}{{/if}} | {{#if description}}{{description}}{{/if}} |{{> components/schemas/_helper_notes_msg defaultUser="server" }}
{{/each}}
{{#each optionalProperties}}
**{{@key.original}}** | {{#if refInfo.refClass}}{{> components/schemas/_helper_refclass_partial }}{{else}}{{> _helper_schema_python_types }}{{/if}} | {{#if refInfo.refClass}}{{> components/schemas/_helper_refclass_partial }}{{else}}{{> components/_helper_schema_accessed_types }}{{#if isComplicated}}[properties.{{@key.camelCase}}](#{{> components/_helper_anchor_id identifierPieces=(append identifierPieces "properties" @key.anchorPiece) includeSuffix=true }}){{/if}}{{/if}} | {{#if description}}{{description}}{{/if}} | [optional]{{> components/schemas/_helper_notes_msg defaultUser="server" }}
**{{@key.original}}** | {{#if refInfo.refClass}}{{> components/schemas/_helper_refclass_partial }}{{#with getDeepestRef}}, {{> _helper_schema_python_types }}{{/with}}{{else}}{{> _helper_schema_python_types }}{{/if}} | {{#if refInfo.refClass}}{{> components/schemas/_helper_refclass_partial }}{{else}}{{#if isComplicated}}[properties.{{@key.camelCase}}](#{{> components/_helper_anchor_id identifierPieces=(append identifierPieces "properties" @key.anchorPiece) includeSuffix=true }}){{else}}{{> components/_helper_schema_accessed_types }}{{/if}}{{/if}} | {{#if description}}{{description}}{{/if}} | [optional]{{> components/schemas/_helper_notes_msg defaultUser="server" }}
{{/each}}
{{#with additionalProperties}}
{{#unless isBooleanSchemaFalse}}
{{#if isBooleanSchemaTrue}}
**any_string_name** | {{> _helper_schema_python_types }} | {{> components/_helper_schema_accessed_types }} | any string name can be used but the value must be the correct type{{#if description}} {{description}}{{/if}} | [optional]
{{else}}
**any_string_name** | {{#if refInfo.refClass}}{{> components/schemas/_helper_refclass_partial }}{{else}}{{> _helper_schema_python_types }}{{/if}} | {{#if refInfo.refClass}}{{> components/schemas/_helper_refclass_partial }}{{else}}{{> components/_helper_schema_accessed_types }}{{#if isComplicated}}[{{@jsonPathPiece.camelCase}}](#{{> components/_helper_anchor_id identifierPieces=(append identifierPieces jsonPathPiece) includeSuffix=true }}){{/if}}{{/if}} | any string name can be used but the value must be the correct type{{#if description}} {{description}}{{/if}} | [optional]{{> components/schemas/_helper_notes_msg defaultUser="server" }}
**any_string_name** | {{#if refInfo.refClass}}{{> components/schemas/_helper_refclass_partial }}{{#with getDeepestRef}}, {{> _helper_schema_python_types }}{{/with}}{{else}}{{> _helper_schema_python_types }}{{/if}} | {{#if refInfo.refClass}}{{> components/schemas/_helper_refclass_partial }}{{else}}{{#if isComplicated}}[{{@jsonPathPiece.camelCase}}](#{{> components/_helper_anchor_id identifierPieces=(append identifierPieces jsonPathPiece) includeSuffix=true }}){{else}}{{> components/_helper_schema_accessed_types }}{{/if}}{{/if}} | any string name can be used but the value must be the correct type{{#if description}} {{description}}{{/if}} | [optional]{{> components/schemas/_helper_notes_msg defaultUser="server" }}
{{/if}}
{{/unless}}
{{else}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ ServerIndexInfo = typing_extensions.TypedDict(
{{/if}}
{{#each paths}}
{{#if servers}}
"paths/{{../@key.original}}/servers": typing_extensions.Literal[{{#each servers}}{{#unless @first}}, {{/unless}}{{@key}}{{/each}}],
"paths/{{@key.original}}/servers": typing_extensions.Literal[{{#each servers}}{{#unless @first}}, {{/unless}}{{@key}}{{/each}}],
{{/if}}
{{#if operations}}
{{#each operations}}
{{#if servers}}
"paths/{{../../@key.original}}/{{../@key.original}}/servers": typing_extensions.Literal[{{#each servers}}{{#unless @first}}, {{/unless}}{{@key}}{{/each}}],
"paths/{{../@key.original}}/{{@key.original}}/servers": typing_extensions.Literal[{{#each servers}}{{#unless @first}}, {{/unless}}{{@key}}{{/each}}],
{{/if}}
{{/each}}
{{/if}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,27 @@

{{headerSize}}## {{paramPrefix}}_params
{{headerSize}}### Request{{paramType}}Parameters.Params
This is a TypedDict

Key | Input Type | Description | Notes
------------- | ------------- | ------------- | -------------
{{#each parameters}}
{{#if refInfo}}
{{getDeepestRef.name}} | [{{refInfo.refClass}}](../../../components/parameters/{{refInfo.refModule}}.md) | | {{#unless getDeepestRef.required}}optional{{/unless}}
{{#with getDeepestRef}}
{{#if schema}}
{{name}} | [{{../refInfo.refClass}}.schema](../../../components/parameters/{{../refInfo.refModule}}.md#schema), {{#with schema}}{{> _helper_schema_python_types }}{{/with}} | | {{#unless required}}optional{{/unless}}
{{else}}
{{#each content}}
{{../name}} | [{{../../refInfo.refClass}}.content.{{@key.snakeCase}}.schema](#{{> components/_helper_anchor_id identifierPieces=(append (newArray ) "content" @key this.schema.jsonPathPiece) includeSuffix=false }}), {{#with schema}}{{> _helper_schema_python_types }}{{/with}} | | {{#unless required}}optional{{/unless}}
{{/each}}
{{/if}}
{{/with}}
{{else}}
{{#if schema}}
{{name}} | [{{jsonPathPiece.camelCase}}.schema](#{{> components/_helper_anchor_id identifierPieces=(append identifierPieces jsonPathPiece schema.jsonPathPiece) includeSuffix=false }}) | | {{#unless required}}optional{{/unless}}
{{name}} | [{{jsonPathPiece.camelCase}}.schema](#{{> components/_helper_anchor_id identifierPieces=(append identifierPieces jsonPathPiece schema.jsonPathPiece) includeSuffix=false }}), {{#with schema}}{{> _helper_schema_python_types }}{{/with}} | | {{#unless required}}optional{{/unless}}
{{else}}
{{#each content}}
{{../name}} | [{{../jsonPathPiece.camelCase}}.content.{{@key.snakeCase}}.schema](#{{> components/_helper_anchor_id identifierPieces=(append identifierPieces ../jsonPathPiece "content" @key this.schema.jsonPathPiece) includeSuffix=false }}) | | {{#unless required}}optional{{/unless}}
{{../name}} | [{{../jsonPathPiece.camelCase}}.content.{{@key.snakeCase}}.schema](#{{> components/_helper_anchor_id identifierPieces=(append identifierPieces ../jsonPathPiece "content" @key this.schema.jsonPathPiece) includeSuffix=false }}), {{#with schema}}{{> _helper_schema_python_types }}{{/with}} | | {{#unless required}}optional{{/unless}}
{{/each}}
{{/if}}
{{/if}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ Name | Type | Description | Notes
{{/if}}
{{/with}}
{{#if queryParams}}
[query_params](#query_params) | [RequestQueryParameters.Params](#requestqueryparametersparams) | |
[query_params](#query_params) | [RequestQueryParameters.Params](#requestqueryparametersparams), dict | |
{{/if}}
{{#if headerParams}}
[header_params](#header_params) | [RequestHeaderParameters.Params](#requestheaderparametersparams) | |
[header_params](#header_params) | [RequestHeaderParameters.Params](#requestheaderparametersparams), dict | |
{{/if}}
{{#if pathParams}}
[path_params](#path_params) | [RequestPathParameters.Params](#requestpathparametersparams) | |
[path_params](#path_params) | [RequestPathParameters.Params](#requestpathparametersparams), dict | |
{{/if}}
{{#if cookieParams}}
[cookie_params](#cookie-params) | [RequestCookieParameters.Params](#requestcookieparametersparams) | |
[cookie_params](#cookie-params) | [RequestCookieParameters.Params](#requestcookieparametersparams), dict | |
{{/if}}
{{#with requestBody}}
{{#if refInfo}}
Expand Down Expand Up @@ -98,7 +98,7 @@ skip_deserialization | bool | default is False | when True, headers and body wil

{{headerSize}}# Return Types

Code | Class | Description
HTTP Status Code | Class | Description
------------- | ------------- | -------------
n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned
{{#if defaultResponse}}
Expand Down Expand Up @@ -130,7 +130,10 @@ default | [{{jsonPathPiece.camelCase}}.response_cls](#{{jsonPathPiece.anchorPiec

Set auth info by setting ApiConfiguration.security_scheme_info to a dict where the
key is the below security scheme quoted name, and the value is an instance of the linked
component security scheme class. See how to do this in the code sample.
component security scheme class.
Select the security index by setting ApiConfiguration.security_index_info or by
passing in security_index into the endpoint method.
See how to do this in the code sample.
- these securities are specific to this to this endpoint

| Security Index | Security Scheme to Scope Names |
Expand All @@ -147,7 +150,10 @@ component security scheme class. See how to do this in the code sample.

Set auth info by setting ApiConfiguration.security_scheme_info to a dict where the
key is the below security scheme quoted name, and the value is an instance of the linked
component security scheme class. See how to do this in the code sample.
component security scheme class.
Select the security index by setting ApiConfiguration.security_index_info or by
passing in security_index into the endpoint method.
See how to do this in the code sample.
- these securities are the general api securities

| Security Index | Security Scheme to Scope Names |
Expand All @@ -162,8 +168,8 @@ component security scheme class. See how to do this in the code sample.
{{headerSize}}# Servers

Set the available servers by defining your used servers in ApiConfiguration.server_info
Then select your server by setting a server_index in ApiConfiguration.server_index or by
passing server_index in to the endpoint function.
Then select your server by setting a server index in ApiConfiguration.server_index_info or by
passing server_index in to the endpoint method.
{{#if servers}}
- these servers are specific to this endpoint
{{#with servers.0}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.0
unset
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ skip_deserialization | bool | default is False | when True, headers and body wil

## Return Types

Code | Class | Description
HTTP Status Code | Class | Description
------------- | ------------- | -------------
n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned
200 | [ResponseFor200.response_cls](#responsefor200-response_cls) | successful operation
Expand Down Expand Up @@ -58,13 +58,13 @@ Content-Type | Schema
##### Type Info
Ref Class | Input Type | Accessed Type | Description
--------- | ---------- | ------------- | ------------
[Client](../../../components/schema/client.md) | dict, frozendict.frozendict, | frozendict.frozendict, |
[Client](../../../components/schema/client.md) | dict, frozendict.frozendict | frozendict.frozendict |

## Servers

Set the available servers by defining your used servers in ApiConfiguration.server_info
Then select your server by setting a server_index in ApiConfiguration.server_index or by
passing server_index in to the endpoint function.
Then select your server by setting a server index in ApiConfiguration.server_index_info or by
passing server_index in to the endpoint method.
- these servers are the general api servers
- defaults to server_index=0, server.url = http://petstore.swagger.io:80/v2

Expand Down
Loading