-
Notifications
You must be signed in to change notification settings - Fork 57
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
Bump cadl ranch 0.37.1 #2815
Bump cadl ranch 0.37.1 #2815
Changes from 7 commits
7875046
574ec8d
ca86a78
6f0f9ec
ab46971
66b81a8
5b27e3d
e0f0afe
37f81b5
4651164
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
changeKind: feature | ||
packages: | ||
- "@azure-tools/typespec-python" | ||
--- | ||
|
||
Add support for `HttpPart<{@body body: XXX}>` of multipart |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -216,7 +216,16 @@ function emitProperty<TServiceOperation extends SdkServiceOperation>( | |
property: SdkBodyModelPropertyType, | ||
): Record<string, any> { | ||
const isMultipartFileInput = property.multipartOptions?.isFilePart; | ||
const sourceType = isMultipartFileInput ? createMultiPartFileType(property.type) : property.type; | ||
let sourceType: SdkType | MultiPartFileType = property.type; | ||
if (isMultipartFileInput) { | ||
sourceType = createMultiPartFileType(property.type); | ||
} else if (property.type.kind === "model") { | ||
const body = property.type.properties.find((x) => x.kind === "body"); | ||
if (body) { | ||
// for `temperature: HttpPart<{@body body: float64, @header contentType: "text/plain"}>`, the real type is float64 | ||
sourceType = body.type; | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it bad that we have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I raise an issue Azure/typespec-azure#1488. If all languages agree Azure/typespec-azure#1488 (comment), TCGC could do the parse logic so that emitters don't need the duplicated work any more. |
||
if (isMultipartFileInput) { | ||
// Python convert all the type of file part to FileType so clear these models' usage so that they won't be generated | ||
addDisableGenerationMap(property.type); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
include *.md | ||
include LICENSE | ||
include azure/clientgenerator/core/flattenproperty/py.typed | ||
include specs/azure/clientgenerator/core/flattenproperty/py.typed | ||
recursive-include tests *.py | ||
recursive-include samples *.py *.md | ||
include azure/__init__.py | ||
include azure/clientgenerator/__init__.py | ||
include azure/clientgenerator/core/__init__.py | ||
include specs/__init__.py | ||
include specs/azure/__init__.py | ||
include specs/azure/clientgenerator/__init__.py | ||
include specs/azure/clientgenerator/core/__init__.py |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{ | ||
"CrossLanguagePackageId": "Azure.ClientGenerator.Core.FlattenProperty", | ||
"CrossLanguagePackageId": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty", | ||
"CrossLanguageDefinitionId": { | ||
"azure.clientgenerator.core.flattenproperty.models.ChildFlattenModel": "Azure.ClientGenerator.Core.FlattenProperty.ChildFlattenModel", | ||
"azure.clientgenerator.core.flattenproperty.models.ChildModel": "Azure.ClientGenerator.Core.FlattenProperty.ChildModel", | ||
"azure.clientgenerator.core.flattenproperty.models.FlattenModel": "Azure.ClientGenerator.Core.FlattenProperty.FlattenModel", | ||
"azure.clientgenerator.core.flattenproperty.models.NestedFlattenModel": "Azure.ClientGenerator.Core.FlattenProperty.NestedFlattenModel", | ||
"azure.clientgenerator.core.flattenproperty.FlattenPropertyClient.put_flatten_model": "Azure.ClientGenerator.Core.FlattenProperty.putFlattenModel", | ||
"azure.clientgenerator.core.flattenproperty.FlattenPropertyClient.put_nested_flatten_model": "Azure.ClientGenerator.Core.FlattenProperty.putNestedFlattenModel" | ||
"specs.azure.clientgenerator.core.flattenproperty.models.ChildFlattenModel": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.ChildFlattenModel", | ||
"specs.azure.clientgenerator.core.flattenproperty.models.ChildModel": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.ChildModel", | ||
"specs.azure.clientgenerator.core.flattenproperty.models.FlattenModel": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.FlattenModel", | ||
"specs.azure.clientgenerator.core.flattenproperty.models.NestedFlattenModel": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.NestedFlattenModel", | ||
"specs.azure.clientgenerator.core.flattenproperty.FlattenPropertyClient.put_flatten_model": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putFlattenModel", | ||
"specs.azure.clientgenerator.core.flattenproperty.FlattenPropertyClient.put_nested_flatten_model": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putNestedFlattenModel" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore |
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 do we need to check if it's "from_typespec". We should also remove this option and deal with the differences earlier on in the pipeline
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.
Without
from_typespec
, there will be diff for legacy code underautorest.python
folder. Since multipart is mainly for typespec design, I think we had better keep legacy same as before.