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

[Bug]: behavior of generated body model from http operation #3421

Closed
4 tasks done
tadelesh opened this issue May 22, 2024 · 4 comments
Closed
4 tasks done

[Bug]: behavior of generated body model from http operation #3421

tadelesh opened this issue May 22, 2024 · 4 comments
Assignees
Labels
bug Something isn't working needs-info Mark an issue that needs reply from the author or it will be closed automatically

Comments

@tadelesh
Copy link
Member

tadelesh commented May 22, 2024

Describe the bug

for this example, we will get two anonymous model for request body and response body. however, for the inner property, it keeps the original Inner model, instead of replacing it with an anonymous model without metadata properties. it seems the metadata handling is not propagated to inner model. idk if it is a bug or by design. it seems kind of inconsistent.

Reproduction

compile with given example and see the result of http operation.

Checklist

@tadelesh tadelesh added the bug Something isn't working label May 22, 2024
@tadelesh tadelesh changed the title [Bug]: behavior generated body model from http operation [Bug]: behavior of generated body model from http operation May 23, 2024
@markcowl
Copy link
Contributor

This seems by design. The metadata properties from the inner property appear in the operation parameters and the response headers, and the request body must treat 'inner' and 'outer' as properties of the request body. Can you explain what OpenAPI you would expect in this case?

@tadelesh
Copy link
Member Author

tadelesh commented May 29, 2024

@markcowl OpenAPI result is good. I expect the type in HttpOperationBody could also remove the metadata properties for inner.
Current type for my example:

{
  properties: [
    outer: string,
    inner: {
      name: Inner,
      properties: [
        h: string,
        prop: string
      ]
    }
  ]
}

Expected:

{
  properties: [
    outer: string,
    inner: {
      properties: [
        prop: string
      ]
    }
  ]
}

@tadelesh tadelesh removed their assignment May 29, 2024
@markcowl
Copy link
Contributor

This is by design, the HttpBody contains an indicator that the model may contain metadata types that need to be removed, and you can use the metadata apis to do this. The idea is to preserve the model that the spec author encoded, because they think these metadata properties are integral to the model (e.g. eTag headers may be crucial to represent with the model).

Note that there is a separate design issue for making a better presentation of the payload on the wire: #3012.

@markcowl markcowl removed their assignment May 30, 2024
@markcowl markcowl added needs-info Mark an issue that needs reply from the author or it will be closed automatically and removed needs-area labels May 30, 2024
Copy link
Contributor

Hi @tadelesh. Since there hasn't been recent engagement, we're going to close this out. Please feel free to reopen if you have any further questions or concerns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-info Mark an issue that needs reply from the author or it will be closed automatically
Projects
None yet
Development

No branches or pull requests

2 participants