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

Wean schema subject quickpick off of getSubjects() / GET /schemas route #1005

Conversation

jlrobins
Copy link
Contributor

@jlrobins jlrobins commented Jan 31, 2025

Summary of Changes

  • schemaSubjectQuickPick(), the quickpick for schema registry subject names (i.e. when uploading a new or revised schema) now based off of GET /subjects route results as from the new ResourceLoader method. Respelling this was low-hanging fruit in revising all callers to getSchemas().
  • Alas, being based only on subject names means we cannot pre-filter based on schema type anymore, so we lose an ounce of functionality when being driven by the 'evolve schema' codepath. If the user picks, say, a preexisting AVRO subject when trying to upload a protobuf schema, now we'll expose the schema registry-produced error message, whereas before we would never let them pick an existing AVRO subject when the upload contents smelled protobuf, and so on.
  • Therefore schemaSubjectQuickPick() and chooseSubject() drop their schema type parameter.
  • Furthermore realize that no caller to either chooseSubject() or schemaSubjectQuickPick() provides the defaultSubject parameter anymore (was legacy from the original "evolve schema" implementation that depended on metadata attached to the editor buffer), so get rid of it. Alas, we hardly knew ye.

Any additional details or context that should be provided?

Pull request checklist

Please check if your PR fulfills the following (if applicable):

Tests
  • Added new
  • Updated existing
  • Deleted existing
Other
  • All new disposables (event listeners, views, channels, etc.) collected as for eventual cleanup?
  • Does anything in this PR need to be mentioned in the user-facing CHANGELOG or README?
  • Have you validated this change locally by packaging and installing the extension .vsix file?
    gulp clicktest

…w schema) now based off of `GET /subjects` route results.
@jlrobins jlrobins requested a review from a team as a code owner January 31, 2025 21:36
@jlrobins jlrobins marked this pull request as draft January 31, 2025 21:40
@jlrobins jlrobins requested a review from Copilot January 31, 2025 21:45
@jlrobins jlrobins marked this pull request as ready for review January 31, 2025 21:45

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Files not reviewed (1)
  • CHANGELOG.md: Evaluated as low risk
Comments suppressed due to low confidence (3)

src/quickpicks/schemas.ts:15

  • The parameter 'defaultSubject' is no longer used and should be removed from the function signature.
defaultSubject: string | undefined = undefined,

src/commands/schemaUpload.ts:222

  • The comment mentions 'schema type' which is no longer a parameter of the function. It should be updated to reflect the current function signature.
// using the given schema type. Will return "" if they want to create a new subject.

src/commands/schemaUpload.ts:222

  • The comment mentions 'defaultSubject' which is no longer a parameter of the function. It should be updated to reflect the current function signature.
// using the given schema type. Will return "" if they want to create a new subject.
@jlrobins jlrobins requested a review from Copilot January 31, 2025 21:48

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Files not reviewed (1)
  • src/quickpicks/schemas.ts: Evaluated as low risk
if (schemas === undefined) {
schemaSubjects = [];
}
const schemaSubjects = await loader.getSubjects(schemaRegistry);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The core change right here. Basing schemaSubjectQuickPick on top of loader.getSubjects(schemaRegistry) returning the sorted subject names instead of loader.getSchemasForRegistry(schemaRegistry) returning all the schema metadatas.

@jlrobins jlrobins requested a review from Copilot February 3, 2025 15:27

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Files not reviewed (1)
  • src/commands/schemaUpload.ts: Evaluated as low risk
@jlrobins jlrobins changed the title Wean schema subject quickpick off of GET /schemas route Wean schema subject quickpick off of getSubjects() / GET /schemas route Feb 3, 2025
@jlrobins jlrobins merged commit 8c86cc8 into main Feb 3, 2025
2 checks passed
@jlrobins jlrobins deleted the 997-migrate-schemasubjectquickpick-to-use-new-resourceloadergetsubjects branch February 3, 2025 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate schemaSubjectQuickPick() to use new ResourceLoader.getSubjects()
2 participants