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

Fix: @typespec/openapi3/invalid-component-fixed-field-key show on incorrect target #5901

Merged
merged 27 commits into from
Feb 26, 2025

Conversation

wanlwanl
Copy link
Member

@wanlwanl wanlwanl commented Feb 7, 2025

Fix: #5832
Result:
image

@azure-sdk
Copy link
Collaborator

azure-sdk commented Feb 7, 2025

All changed packages have been documented.

  • @typespec/openapi3
Show changes

@typespec/openapi3 - fix ✏️

Fix: @typespec/openapi3/invalid-component-fixed-field-key show on incorrect target

@azure-sdk
Copy link
Collaborator

azure-sdk commented Feb 7, 2025

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@wanlwanl
Copy link
Member Author

wanlwanl commented Feb 8, 2025

@timotheeguerin, there's a case I'd like to discuss when new model name could be the same to existing model name:
e.g. suppose we have old model name: foo-/invalid, and existing model name: foo-invalid1, the function to get new model is

const maxRetry = 100000;
const getSuffix = (index) => index;
const getNewName = (name) => { 
  let currentName = name;
  for (let index = 1; alreadyHasSameName(currentName); index++) {
    currentName = name + getsuffix(index);
  }
  return currentName;
}

How much maxRetry is reasonable? Or we don't need it?
I think appending index is enough and no need to append complex random string/guid to avoid conflict, right?

@timotheeguerin
Copy link
Member

I don't think we need, feels like an edge case already and probably unlikely you will hit a duplicate if you replace with underscore

@wanlwanl
Copy link
Member Author

@timotheeguerin I udpated this PR, please review it.

@wanlwanl wanlwanl enabled auto-merge February 26, 2025 00:59
@wanlwanl wanlwanl added this pull request to the merge queue Feb 26, 2025
@timotheeguerin timotheeguerin removed this pull request from the merge queue due to a manual request Feb 26, 2025
@wanlwanl wanlwanl enabled auto-merge February 26, 2025 02:43
@wanlwanl wanlwanl added this pull request to the merge queue Feb 26, 2025
Merged via the queue into microsoft:main with commit b742e16 Feb 26, 2025
24 checks passed
@wanlwanl wanlwanl deleted the wanl/fix-diag-1 branch February 26, 2025 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
emitter:openapi3 Issues for @typespec/openapi3 emitter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@typespec/openapi3/invalid-component-fixed-field-key error should show up where the name is not on the service
4 participants