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

Add guidelines to prefer "flat" over "nested" structures #541

Open
mikekistler opened this issue Apr 22, 2024 · 3 comments
Open

Add guidelines to prefer "flat" over "nested" structures #541

mikekistler opened this issue Apr 22, 2024 · 3 comments
Labels
Azure Guidelines This issue relates to the Azure Guidelines.

Comments

@mikekistler
Copy link
Member

Nesting complicates the user experience and should only be used when necessary. We should add guidance to use flat structures unless there is some significant value to nesting, with some specific examples where nesting does add value and where it does not.

@mikekistler mikekistler added the Azure Guidelines This issue relates to the Azure Guidelines. label Apr 22, 2024
@rkmanda
Copy link

rkmanda commented Apr 23, 2024

Should we deprecate the use of x-ms-client-flatten and get rid of any guidance around it? while still keeping the guidance to encourage flatter schemas?

@JeffreyRichter
Copy link
Contributor

Pasting my comment from Teams chat:
Well, getting rid of it now will probably break SDKs. However, I do not think that TypeSpec has an equivalent for flatten so breaking may happen anyway. For greenfield, services should design their schema as they want it and this is how it should appear to customers. x-ms-client-flatten was a bad idea; it makes debugging harder and it breaks json merge patch. We'd love to get rid of it but we prioritze not breaking customers who are using stuff that already GA'd.

@mikekistler
Copy link
Member Author

I think we should deprecate the use of x-ms-flatten in greenfield services. As Jeffrey says, if it is already in place in a GA API, we'll just have to live with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure Guidelines This issue relates to the Azure Guidelines.
Projects
None yet
Development

No branches or pull requests

3 participants