Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Add python AWS Signature v4 support #64

Closed
jblakeney wants to merge 11 commits into openapi-json-schema-tools:2_0_0 from jblakeney:python_awsv4_support
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
11 commits
Select commit Hold shift + click to select a range
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
5 changes: 5 additions & 0 deletions .gitignore
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ samples/client/petstore/python/swagger_client.egg-info/SOURCES.txt
samples/client/petstore/python/.coverage
samples/client/petstore/python/.projectile
samples/client/petstore/python/.venv/
samples/client/petstore/python_aws_sigv4/dev-requirements.txt.log
samples/client/petstore/python_aws_sigv4/swagger_client.egg-info/SOURCES.txt
samples/client/petstore/python_aws_sigv4/.coverage
samples/client/petstore/python_aws_sigv4/.projectile
samples/client/petstore/python_aws_sigv4/.venv/
samples/client/petstore/python-asyncio/.venv/
samples/client/petstore/python-asyncio/.pytest_cache/
samples/client/petstore/python-tornado/.venv/
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ cache:
- $HOME/samples/client/petstore/php/OpenAPIToolsClient-php/vendor
- $HOME/samples/client/petstore/ruby/vendor/bundle
- $HOME/samples/client/petstore/python/.venv/
- $HOME/samples/client/petstore/python_aws_sigv4/.venv/
- $HOME/samples/server/petstore/rust-server/target
- $HOME/perl5
- $HOME/.cargo
Expand Down
7 changes: 7 additions & 0 deletions bin/configs/python_aws_sigv4.yaml
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
generatorName: python
outputDir: samples/openapi3/client/petstore/python_aws_sigv4
Copy link
Contributor

@spacether spacether Oct 28, 2022
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about renaming the spec file something like signing_spec.yaml?
How about outputting the sample into the features directory?
How about changing the package name to something like signing_spec_api?
With these changes I can reuse your sample spec to test the other signing module.
This sample is not related to petstore.

jblakeney reacted with thumbs up emoji
inputSpec: modules/openapi-json-schema-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing-with-aws-sigv4.yaml
templateDir: modules/openapi-json-schema-generator/src/main/resources/python
additionalProperties:
packageName: petstore_api
recursionLimit: "1234"
4 changes: 2 additions & 2 deletions docs/new-generator.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,10 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
{{#parent}}
{{#parentVars}}
**{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
**{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{refClass}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
{{/parentVars}}
{{/parent}}
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{refClass}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
{{/vars}}

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/templating.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ Supporting files can either be processed through the templating engine or copied

> This is a very limited list of variable name explanations. Feel free to [open a pull request](https://github.com/OpenAPITools/openapi-generator/pull/new/master) to add to this documentation!

- **complexType**: stores the name of the model (e.g. Pet)
- **refClass**: stores the name of the model (e.g. Pet)
- **isContainer**: true if the parameter or property is an array or a map.
- **isPrimitiveType**: true if the parameter or property type is a primitive type (e.g. string, integer, etc) as defined in the spec.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
*/
public String openApiType;
public String baseName;
public String complexType;
public String refClass;
public String getter;
public String setter;
/**
Expand Down Expand Up @@ -258,12 +258,12 @@ public void setBaseName(String baseName) {
this.baseName = baseName;
}

public String getComplexType() {
return complexType;
public String getRefClass() {
return refClass;
}

public void setComplexType(String complexType) {
this.complexType = complexType;
public void setRefClass(String refClass) {
this.refClass = refClass;
}

public String getGetter() {
Expand Down Expand Up @@ -978,7 +978,7 @@ public String toString() {
final StringBuilder sb = new StringBuilder("CodegenProperty{");
sb.append("openApiType='").append(openApiType).append('\'');
sb.append(", baseName='").append(baseName).append('\'');
sb.append(", complexType='").append(complexType).append('\'');
sb.append(", refClass='").append(refClass).append('\'');
sb.append(", getter='").append(getter).append('\'');
sb.append(", setter='").append(setter).append('\'');
sb.append(", description='").append(description).append('\'');
Expand Down Expand Up @@ -1151,7 +1151,7 @@ public boolean equals(Object o) {
Objects.equals(composedSchemas, that.composedSchemas) &&
Objects.equals(openApiType, that.openApiType) &&
Objects.equals(baseName, that.baseName) &&
Objects.equals(complexType, that.complexType) &&
Objects.equals(refClass, that.refClass) &&
Objects.equals(getter, that.getter) &&
Objects.equals(setter, that.setter) &&
Objects.equals(description, that.description) &&
Expand Down Expand Up @@ -1197,7 +1197,7 @@ public boolean equals(Object o) {
@Override
public int hashCode() {

return Objects.hash(openApiType, baseName, complexType, getter, setter, description,
return Objects.hash(openApiType, baseName, refClass, getter, setter, description,
dataType, datatypeWithEnum, dataFormat, name, min, max, defaultValue,
defaultValueWithParam, baseType, containerType, title, unescapedDescription,
maxLength, minLength, pattern, example, jsonSchema, minimum, maximum,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
private Map<String, CodegenProperty> requiredVarsMap;
private String ref;
private boolean schemaIsFromAdditionalProperties;
public Set<String> imports = new TreeSet<>();

@Override
public int hashCode() {
Expand All @@ -105,7 +106,7 @@ public int hashCode() {
getMinLength(), exclusiveMinimum, exclusiveMaximum, getMinimum(), getMaximum(), getPattern(),
is1xx, is2xx, is3xx, is4xx, is5xx, additionalPropertiesIsAnyType, hasVars, hasRequired,
hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, responseHeaders, content,
requiredVarsMap, ref, uniqueItemsBoolean, schemaIsFromAdditionalProperties);
requiredVarsMap, ref, uniqueItemsBoolean, schemaIsFromAdditionalProperties, imports);
}

@Override
Expand Down Expand Up @@ -155,6 +156,7 @@ public boolean equals(Object o) {
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
getHasVars() == that.getHasVars() &&
getHasRequired() == that.getHasRequired() &&
Objects.equals(imports, that.imports) &&
Objects.equals(uniqueItemsBoolean, that.getUniqueItemsBoolean()) &&
Objects.equals(ref, that.getRef()) &&
Objects.equals(requiredVarsMap, that.getRequiredVarsMap()) &&
Expand Down Expand Up @@ -612,6 +614,7 @@ public String toString() {
sb.append(", requiredVarsMap=").append(requiredVarsMap);
sb.append(", ref=").append(ref);
sb.append(", schemaIsFromAdditionalProperties=").append(schemaIsFromAdditionalProperties);
sb.append(", imports=").append(imports);
sb.append('}');
return sb.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class CodegenSecurity {
// Those are to differentiate basic and bearer authentication
// isHttpSignature is to support HTTP signature authorization scheme.
// https://datatracker.ietf.org/doc/draft-cavage-http-signatures/
public Boolean isBasicBasic, isBasicBearer, isHttpSignature;
public Boolean isBasicBasic, isBasicBearer, isHttpSignature, isAwsSignatureV4;
public String bearerFormat;
public Map<String, Object> vendorExtensions = new HashMap<String, Object>();
// ApiKey specific
Expand All @@ -52,6 +52,7 @@ public CodegenSecurity filterByScopeNames(List<String> filterScopes) {
filteredSecurity.isBasic = isBasic;
filteredSecurity.isBasicBasic = isBasicBasic;
filteredSecurity.isHttpSignature = isHttpSignature;
filteredSecurity.isAwsSignatureV4 = isAwsSignatureV4;
filteredSecurity.isBasicBearer = isBasicBearer;
filteredSecurity.isApiKey = isApiKey;
filteredSecurity.isOAuth = isOAuth;
Expand Down Expand Up @@ -100,6 +101,7 @@ public boolean equals(Object o) {
Objects.equals(isApiKey, that.isApiKey) &&
Objects.equals(isBasicBasic, that.isBasicBasic) &&
Objects.equals(isHttpSignature, that.isHttpSignature) &&
Objects.equals(isAwsSignatureV4, that.isAwsSignatureV4) &&
Objects.equals(isBasicBearer, that.isBasicBearer) &&
Objects.equals(bearerFormat, that.bearerFormat) &&
Objects.equals(vendorExtensions, that.vendorExtensions) &&
Expand All @@ -122,7 +124,7 @@ public boolean equals(Object o) {
public int hashCode() {

return Objects.hash(name, type, scheme, isBasic, isOAuth, isApiKey,
isBasicBasic, isHttpSignature, isBasicBearer, bearerFormat, vendorExtensions,
isBasicBasic, isHttpSignature, isAwsSignatureV4, isBasicBearer, bearerFormat, vendorExtensions,
keyParamName, isKeyInQuery, isKeyInHeader, isKeyInCookie, flow,
authorizationUrl, tokenUrl, refreshUrl, scopes, isCode, isPassword, isApplication, isImplicit);
}
Expand All @@ -138,6 +140,7 @@ public String toString() {
sb.append(", isApiKey=").append(isApiKey);
sb.append(", isBasicBasic=").append(isBasicBasic);
sb.append(", isHttpSignature=").append(isHttpSignature);
sb.append(", isAwsSignatureV4=").append(isAwsSignatureV4);
sb.append(", isBasicBearer=").append(isBasicBearer);
sb.append(", bearerFormat='").append(bearerFormat).append('\'');
sb.append(", vendorExtensions=").append(vendorExtensions);
Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /