microsoft / microsoft/typespec

[python] add headers as properties to our DPG models

Open
#5,776 0 comments 0 reactions 1 assignee Claimed by @iscai-msft View on GitHub
emitter:client:python
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

transferred from https://github.com/Azure/autorest.python/issues/1991

Right now, a DPG response model only represents a response body. If TypeSpec defines a response model as including response headers as well (think `BlobProperties` in storage), we want to include that information in our DPG response model.

We've thought of a few ways of including this on our response model. For all of these ways we've decided not to include the header properties on the dictionary representation of the model, so the header properties will all be attribute only, and will not show up in dict-syntax.

1. Have header properties as top-level attributes, i.e. `my_model.my_header_attribute`
2. Have a `.headers` attribute on these models, i.e. `my_model.headers.my_header_attribute`
3. Have a `.get_headers()` attribute on these models, i.e. `my_model.get_headers().my_header_attribute`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.