Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restore sanitize test for serialization with different data types #5

Merged
merged 2 commits into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bin/configs/typescript-angular-v16-provided-in-root.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ templateDir: modules/openapi-generator/src/main/resources/typescript-angular
additionalProperties:
ngVersion: 16.1.2
supportsES6: true
enumNameMappings:
delivered: SHIPPED
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,10 @@ public String toEnumDefaultValue(String value, String datatype) {

@Override
public String toEnumVarName(String name, String datatype) {
if (enumNameMapping.containsKey(name)) {
return enumNameMapping.get(name);
}

if (name.length() == 0) {
return getNameUsingEnumPropertyNaming("empty");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export namespace Order {
export const StatusEnum = {
Placed: 'placed' as StatusEnum,
Approved: 'approved' as StatusEnum,
Delivered: 'delivered' as StatusEnum
SHIPPED: 'delivered' as StatusEnum
};
}

Expand Down
5 changes: 4 additions & 1 deletion samples/openapi3/client/petstore/python/tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,10 @@ def test_valdiator(self):
a.pattern_with_digits_and_delimiter = "image_123"
self.assertEqual(a.pattern_with_digits_and_delimiter, "image_123")

# test sanitize for serializaation with SecretStr (format: password)
# test sanitize for serialization with different data types
self.assertEquals(petstore_api.ApiClient().sanitize_for_serialization(a), {'byte': b'string', 'date': '2013-09-17', 'number': 123.45, 'password': 'testing09876', 'pattern_with_digits_and_delimiter': 'image_123'})

# test sanitize for serialization with SecretStr (format: password)
class LoginTest(BaseModel):
username: StrictStr = Field(min_length=2, strict=True, max_length=64)
password: SecretStr
Expand Down
Loading