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

How to interpret bodyRoot nested path/query/header/key properties? #6246

Closed
MaryGao opened this issue Mar 4, 2025 · 8 comments
Closed

How to interpret bodyRoot nested path/query/header/key properties? #6246

MaryGao opened this issue Mar 4, 2025 · 8 comments

Comments

@MaryGao
Copy link
Member

MaryGao commented Mar 4, 2025

This is a side issue when we ask the interpretion of Azure template and I found when handling the path and other parameters there exists in-consistancy for openapi emtters. I'd like to confirm if this is an issue or by design.

playground

op create(
  @bodyRoot
  body: Cluster,
): Cluster;

model Cluster {
  @path
  pathParam: string;

  @header
  headerParam: string;

  @query
  queryParam: string;

  @key
  idKey: string;

  prop: string;
}

The current interpretion are as followings:

Request Response
Path request path response body property
Query request path response body property
Header request header response header with same name
Key request body property response body property

Here are the questions:

  • Both path and query property would be a normal response body property, is this expected?
  • Can we differentiate request header and output header?
  • Does @key property indicate read-only information and only for response body?
@MaryGao MaryGao changed the title [Http] How to interpret bodyRoot nested path/query/header/key properties? How to interpret bodyRoot nested path/query/header/key properties? Mar 4, 2025
@timotheeguerin
Copy link
Member

timotheeguerin commented Mar 4, 2025

using @bodyRoot is the same as not using anything for the resolution of metadata properties. It just move the implicit body resolution to that property instead of the root of the parameters or response.

  1. Both path and query property would be a normal response body property, is this expected?
    yes
  2. Can we differentiate request header and output header?
    not sure what you mean, you have to check where its used
  3. Does @key property indicate read-only information and only for response body?
    no, @key is a core concept that just mark something as a key, it has no effect on http library(rest does make use of it with resource but not http)

@timotheeguerin timotheeguerin added the needs-info Mark an issue that needs reply from the author or it will be closed automatically label Mar 4, 2025
@MaryGao MaryGao removed their assignment Mar 5, 2025
@MaryGao
Copy link
Member Author

MaryGao commented Mar 5, 2025

Thanks @timotheeguerin for sharing! Regarding the 2nd question, my point is both request and response has headers, if a model is shared by request/response, how do we differentiate that header is request header or output header?

@microsoft-github-policy-service microsoft-github-policy-service bot removed the needs-info Mark an issue that needs reply from the author or it will be closed automatically label Mar 5, 2025
@timotheeguerin
Copy link
Member

They are both, you can use visibility to filter

@MaryGao
Copy link
Member Author

MaryGao commented Mar 5, 2025

With above interpretions could we document this done and let user know about this behavior?

It seems we leverage visibility to take the uage's role(input/output). What if we add read-only visibility to above path property, does that mean we still have that path paramter or not?

@timotheeguerin
Copy link
Member

No path parmaeter is not there anymore playground

@MaryGao
Copy link
Member Author

MaryGao commented Mar 5, 2025

Got it and thanks!

@timotheeguerin
Copy link
Member

can this be closed or there is more concern?

@MaryGao
Copy link
Member Author

MaryGao commented Mar 5, 2025

Closed as resolved.

@MaryGao MaryGao closed this as completed Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants