Make MODEL_TYPE fragment classification non-breaking#217
Open
llali wants to merge 1 commit into
Open
Conversation
Commit 20f9bf1 (PR #210, fixing #176) reclassified MODEL_TYPE as a TSqlFragment but broke the public API: it repurposed the enum ExternalModelTypeOption into a fragment class and changed the type of ExternalModelStatement.ModelType from ExternalModelTypeOption? to a fragment reference. This change delivers the same fix additively, without breaking the API: - Keep enum ExternalModelTypeOption { EMBEDDINGS } and the ExternalModelStatement.ModelType (ExternalModelTypeOption?) member unchanged for backward compatibility. - Add a visitable fragment ExternalModelTypeSpecification whose OptionKind reuses the existing ExternalModelTypeOption enum, plus a new ModelTypeSpecification member on ExternalModelStatement. - The parser populates both representations; the script generator prefers the fragment and falls back to the legacy enum. All 624 unit tests pass on net8.0 and net472.
llali
requested review from
chlafreniere,
dzsquared,
kburtram and
ssreerama
as code owners
July 20, 2026 20:38
Member
Author
|
@ZEUSXXIV you commit caused breaking changes and I had to make these changes in this PR to make sure you fix stays but also they won't be any breaking changes. please let me know if you have any comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reworks the
MODEL_TYPEfix so it fixes the fragment-classification bug (#176) without breaking the public API.Background
Commit
20f9bf1(PR #210, fixing #176) reclassifiedMODEL_TYPEas aTSqlFragment, but did so in a breaking way:enum ExternalModelTypeOption { EMBEDDINGS }into aTSqlFragmentclass.ExternalModelStatement.ModelTypefromExternalModelTypeOption?(nullable enum) to a fragment reference.EMBEDDINGS→Embeddings(moved into a newExternalModelTypeOptionKindenum).Any downstream consumer (e.g. DacFx) referencing
ExternalModelTypeOption.EMBEDDINGSor readingModelTypeas an enum would fail to compile.What this PR does instead (additive / non-breaking)
enum ExternalModelTypeOption { EMBEDDINGS }and theExternalModelStatement.ModelType(ExternalModelTypeOption?) member unchanged for backward compatibility.ExternalModelTypeSpecificationwhoseOptionKindreuses the existingExternalModelTypeOptionenum, plus a newModelTypeSpecificationmember onExternalModelStatement.MODEL_TYPEnot classified asTSqlFragmentinCreateExternalModelStatement#176 (MODEL_TYPE is now a proper visitable fragment with real token offsets) while existing enum-based consumers keep compiling.Files changed
SqlScriptDom/Parser/TSql/Ast.xmlSqlScriptDom/Parser/TSql/ExternalModelTypeOption.csSqlScriptDom/Parser/TSql/TSql170.g,TSql180.gSqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.CreateExternalModelStatement.csSqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGenerator.AlterExternalModelStatement.csTest/SqlDom/Only170SyntaxTests.csTesting
net8.0andnet472.ModelTypeSpecification/OptionKind) and the legacy enum (ModelType == ExternalModelTypeOption.EMBEDDINGS) to prove backward compatibility.