-
Notifications
You must be signed in to change notification settings - Fork 226
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
Wrong type ouput for getEffectiveModelType
#2991
Comments
What options to you pass to |
|
@timotheeguerin JS has two cases failed and our current workaround is to get rid of getEffectiveModelType if the model has a name. Case 1: A is TemplateModelThe getEffectiveModelType(a) would return Template name as model not A, this introduced a lot of duplicated names because they would always return the template name(see js issue).
Case 2: A extends BThe getEffectiveModelType(a) would return B and also this caused duplicated names and also caused hierarchy information lost.
|
One more case is for spread usage, i just guess maybe all of them are the same root cause.
|
So I think its maybe just how you are using it that might be wrong. Are you using the same call in the request and response with The problem I think if you look at all the repros is the model that doesn't get returned contains only a single readonly metadata property(It is in the response body but it is a metadata property) What I think you might want to do instead is call with If that's not the case are those cases reproducing with openapi3 or autorest emitter? can you share a whole repro in there? (For example @MaryGao your example works fine for me at picking up |
Ok actually if I update the previous playground with an intersection then it is getting into that problem. However I have this exact issue fixed in the body consistency pr Playground from that pr as example |
Yeah in our code we use Could you explian with me what is the usage assumption for getEffectiveModelType? Imagine following A and C types we would use filter to filter out
|
Yeah sorry I actually got mistaken from my previous playground it is not working there too. Yeah I do feel like For why you need visibility, it depends on the usage but for the use case of openapi we need to create a definition for the body exactly(so extract the metadata property out) but we need to get a name (if possible) for that body. The body might not be the same in the request or response depending on the visibility so it could alter what is the effective model type. |
I believe this will be addressed by this: #3012 |
In ARM operation templates (as in rest operation templates), the logical request and response type for a model is given by the meanwhile MPG emitters should use |
For the following TypeSpec, when we call
getEffectiveModelType
for typeProduct
, we will get a type namedProxyResource
with the same properties of the original typeProduct
. I suppose it should return the original type ofProduct
.This output may impact many things, include the output of
getLroMetadata
for Azure: Azure/typespec-azure#311.The text was updated successfully, but these errors were encountered: