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

x-ms-identifiers alternative #1473

Open
Tracked by #687
timotheeguerin opened this issue Sep 4, 2024 · 2 comments
Open
Tracked by #687

x-ms-identifiers alternative #1473

timotheeguerin opened this issue Sep 4, 2024 · 2 comments
Assignees
Labels
design:accepted Proposal for design has been discussed and accepted. lib:azure-resource-manager Issues for @azure-tools/typespec-azure-core library

Comments

@timotheeguerin
Copy link
Member

timotheeguerin commented Sep 4, 2024

Design approved

  1. Use @key whenever possible(including new multiple key feature added by microsoft/typespec
  2. If the default behavior is not suitable add a new decorator @identifiers
extern dec identifiers(target: ModelProperty, properties: ModelProperty[]);

function getModelIdentifiers(program: Program, model: Model): ModelProperty[];

decorator could potentially validate that the identifier specified are not the same as the default ones

@timotheeguerin timotheeguerin added the design:needed A design request has been raised that needs a proposal label Sep 4, 2024
@markcowl markcowl added this to the Backlog milestone Sep 6, 2024
@markcowl markcowl added lib:azure-resource-manager Issues for @azure-tools/typespec-azure-core library and removed needs-area labels Sep 6, 2024
@markcowl markcowl modified the milestones: Backlog, [2024] October Sep 10, 2024
@markcowl markcowl added design:accepted Proposal for design has been discussed and accepted. and removed design:needed A design request has been raised that needs a proposal labels Sep 25, 2024
@markcowl
Copy link
Member

Proposal is here:https://gist.github.com/markcowl/d316ff4566aa04c5332c33402fbd218c

  • Relax checks for multiple keys in REST library
  • Add identifiers decorator and accessor into typespec-azure-core

@markcowl markcowl removed this from the [2024] October milestone Sep 25, 2024
@markcowl markcowl added this to the [2024] November milestone Oct 9, 2024
@timotheeguerin timotheeguerin removed their assignment Oct 17, 2024
@AlitzelMendez AlitzelMendez self-assigned this Nov 7, 2024
@AlitzelMendez
Copy link
Member

Adding more information, as talked with Mark offline about this issue and he shared with me more insights:

The expectation for this issue is:

  • Add a decorator in typespsec-azure-resourcemanager that sets the x-m-identifiers for a model type or an array model property
  • Add a helper in the same library that will determine the x-ms-identifiers values for an array property, either from applications of the decorator above, or from properties marked as keys.
  • Update typespec-autorest to use this new helper to emit x-ms-identifiers
  • When looking at specs, remove any use of extension decorators, then determine which specs need to be updated with the new decorator

The idea is that the default is to collect and use the 'key' properties to determine the identifiers, but for existing specs, in cases where this does not produce the right result, use the new decorator to mimic the x-ms-identifiers they previously set through extensions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design:accepted Proposal for design has been discussed and accepted. lib:azure-resource-manager Issues for @azure-tools/typespec-azure-core library
Projects
None yet
Development

No branches or pull requests

3 participants