You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The check tries to ensure the TSP and swagger are in sync via this algorithm:
Run tsp compile . (and optionally tsp compile client.tsp)
Run git diff
If any files have been added, modified, or deleted: FAIL
This catches most ways that TSP and swagger can be out-of-sync, but it misses an important one. If a swagger file (containing x-typespec-generated) is manually added to the output folder, we don't verify that the file can be re-generated by running tsp compile. We only verify that running tsp compile doesn't change any output files.
One way to fix this, is to delete any files we think should be generated by a given TypeSpec folder, before running tsp compile.
Under output folder, delete all JSON files contaning x-typespec-generated.
Run tsp compile .
Run git diff
If any files have been added, modified, or deleted: FAIL
This way, if a new version is manually added to the output folder, without corresponding TSP sources, it will be detected as a deleted file.
A remaining gap in this algorithm, is if a new top-level folder is added under data-plane|resource-manager, without corresponding TSP sources. This is a slightly different case, since each top-level folder under data-plane|resource-manager is considered a distinct "spec". This will be addressed in a separate issue.
Example of invalid spec currently being missed by this gap. Swagger file with version 2024-08-01-preview:
The check tries to ensure the TSP and swagger are in sync via this algorithm:
tsp compile .
(and optionallytsp compile client.tsp
)git diff
This catches most ways that TSP and swagger can be out-of-sync, but it misses an important one. If a swagger file (containing
x-typespec-generated
) is manually added to the output folder, we don't verify that the file can be re-generated by runningtsp compile
. We only verify that runningtsp compile
doesn't change any output files.One way to fix this, is to delete any files we think should be generated by a given TypeSpec folder, before running
tsp compile
.Example:
New algorithm:
x-typespec-generated
.tsp compile .
git diff
This way, if a new version is manually added to the output folder, without corresponding TSP sources, it will be detected as a deleted file.
A remaining gap in this algorithm, is if a new top-level folder is added under
data-plane|resource-manager
, without corresponding TSP sources. This is a slightly different case, since each top-level folder underdata-plane|resource-manager
is considered a distinct "spec". This will be addressed in a separate issue.Example of invalid spec currently being missed by this gap. Swagger file with version
2024-08-01-preview
:https://github.com/Azure/azure-rest-api-specs/blob/cf170ef8e99c2ed03edf520c54effa6d5435df28/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2024-08-01-preview/generated.json
But TSP sources don't contain this version:
azure-rest-api-specs/specification/cognitiveservices/OpenAI.Inference/main.tsp
Lines 76 to 78 in cf170ef
The text was updated successfully, but these errors were encountered: