-
Notifications
You must be signed in to change notification settings - Fork 230
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
[python] Add test for typespec namespace #5574
base: main
Are you sure you want to change the base?
Conversation
No changes needing a change description found. |
You can try these changes here
|
@@ -159,7 +159,9 @@ def serialize(self) -> None: | |||
self._serialize_and_write_top_level_folder(env=env, namespace=client_namespace) | |||
|
|||
# add models folder if there are models in this namespace | |||
if (client_namespace_type.models or client_namespace_type.enums) and self.code_model.options["models_mode"]: | |||
if ( | |||
self.code_model.has_non_json_models(client_namespace_type.models) or client_namespace_type.enums |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When there are only json models which will not be serialized, we shall skip the serialization for models.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain this logic more clearly? I'm having a hard time following this and also only writing the models file below if there are non-json models
@@ -6,7 +6,9 @@ | |||
{{ imports }} | |||
{{ unset }} | |||
{% if code_model.options["builders_visibility"] == "embedded" and not async_mode %} | |||
{% if need_declare_serializer %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix unused declaration for __SERIALIZER = Serializer()
@@ -452,7 +456,7 @@ def imports( # pylint: disable=too-many-branches, disable=too-many-statements | |||
file_import.add_import("json", ImportType.STDLIB) | |||
if any(xml_serializable(str(r.default_content_type)) for r in self.responses): | |||
file_import.add_submodule_import(relative_path, "_deserialize_xml", ImportType.LOCAL) | |||
elif any(r.type for r in self.responses): | |||
elif self.need_deserialize: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix unused import _deserialize
.
@@ -159,7 +159,9 @@ def serialize(self) -> None: | |||
self._serialize_and_write_top_level_folder(env=env, namespace=client_namespace) | |||
|
|||
# add models folder if there are models in this namespace | |||
if (client_namespace_type.models or client_namespace_type.enums) and self.code_model.options["models_mode"]: | |||
if ( | |||
self.code_model.has_non_json_models(client_namespace_type.models) or client_namespace_type.enums |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain this logic more clearly? I'm having a hard time following this and also only writing the models file below if there are non-json models
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did all of these files move from generic -> azure? does it have to do with azure-http-specs? I wasn't here for the change, so am a little lost here
result = client.property.float_seconds(FloatSecondsDurationProperty(value=35.625)) | ||
assert abs(result.value - 35.625) < 0.0001 | ||
result = client.property.float64_seconds(FloatSecondsDurationProperty(value=35.625)) | ||
assert abs(result.value - 35.625) < 0.0001 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we splitting the existing generic tests into azure and unbranded?
} | ||
|
||
// when package name is different with typespec namespace, disable typespec namespace | ||
if (flavor !== "azure") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm lost why we have this default flag setting in regenerate.ts. Why are we not relying on the default behavior in our emitter, and where needed, change enable-typespec-namespace
to be the value we want to be
Fix Azure/autorest.python#2998