Skip to content

[Swagger Linter Migration] ParametersSchemaAsTypeObject (origin) - #5350

Draft
Yuchao Yan (msyyc) wants to merge 1 commit into
Azure:feature/lintdiff-migration-newfrom
msyyc:feature/lintdiff-parameters-schema-as-type-object-schema-less-repair
Draft

[Swagger Linter Migration] ParametersSchemaAsTypeObject (origin)#5350
Yuchao Yan (msyyc) wants to merge 1 commit into
Azure:feature/lintdiff-migration-newfrom
msyyc:feature/lintdiff-parameters-schema-as-type-object-schema-less-repair

Conversation

@msyyc

Copy link
Copy Markdown
Member

Summary

  • make ParametersSchemaAsTypeObject follow AutoRest request-body emission across body kinds and all reachable TypeSpec type families
  • model scalar and property encoding behavior, including nested encodings, supported-format filtering, inline versus referenced schemas, singleton/nullable wrappers, secrets, files, multipart bodies, empty enums, and unbased scalars
  • add six focused comparison fixture groups and an emitter-backed semantic matrix
  • strengthen the generic develop-lintdiff-rule skill with an emission-dependent semantic completeness gate

Validation

  • focused comparison: 17 fixtures, 5 violating fixtures covered, 12 validator-clean fixtures reviewed, 0 unresolved gaps
  • explicit-schema fixture: 13 Swagger diagnostics and 13 TypeSpec diagnostics
  • package build and 24 tests passed
  • full corpus at f6b53f105b95da05276530a0754a1c71b4f16397: 462/468 projects compiled; 9 Swagger projects, 9 TypeSpec projects, 9 overlap, no one-sided projects; 18 Swagger diagnostics and 19 raw/18 deduplicated TypeSpec diagnostics

Known boundary

External schemas supplied through AutoRest @useRef are opaque to the TypeSpec semantic program. The equivalence claim excludes pathological primitive external references; diagnosing every @useRef model would reject intended object-schema references.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Extends the migrated ParametersSchemaAsTypeObject lint rule to mirror AutoRest request-body schema emission across additional TypeSpec shapes.

Changes:

  • Adds scalar encoding, enum, file, multipart, and model-property handling.
  • Adds six fixture groups and emission-matrix documentation.
  • Strengthens LintDiff migration guidance for emission-dependent rules.

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
.github/skills/develop-lintdiff-rule/SKILL.md Adds semantic completeness guidance.
packages/typespec-lintdiff/src/rules/parameters-schema-as-type-object.ts Expands emitted-schema classification.
packages/typespec-lintdiff/test/fixtures/ParametersSchemaAsTypeObject/rule.md Documents the emission matrix.
packages/typespec-lintdiff/test/fixtures/ParametersSchemaAsTypeObject/migration.md Records migration evidence and boundaries.
.../unbased-scalar-body/main.tsp Defines the unbased-scalar case.
.../unbased-scalar-body/output.json Captures emitted OpenAPI.
.../unbased-scalar-body/expect.json Declares expected compliance.
.../unbased-scalar-body/tsp-diagnostics.json Captures TypeSpec diagnostics.
.../unbased-scalar-body/validator-diagnostics.json Captures validator results.
.../multipart-body/main.tsp Defines the multipart case.
.../multipart-body/output.json Captures emitted OpenAPI.
.../multipart-body/expect.json Declares expected compliance.
.../multipart-body/tsp-diagnostics.json Captures TypeSpec diagnostics.
.../multipart-body/validator-diagnostics.json Captures validator results.
.../explicit-schema-type-bodies/main.tsp Defines explicit non-object cases.
.../explicit-schema-type-bodies/output.json Captures emitted OpenAPI.
.../explicit-schema-type-bodies/expect.json Declares expected violations.
.../explicit-schema-type-bodies/tsp-diagnostics.json Captures TypeSpec diagnostics.
.../explicit-schema-type-bodies/validator-diagnostics.json Captures validator results.
.../encoded-model-property-body/main.tsp Defines referenced-property encoding cases.
.../encoded-model-property-body/output.json Captures emitted OpenAPI.
.../encoded-model-property-body/expect.json Declares expected compliance.
.../encoded-model-property-body/tsp-diagnostics.json Captures TypeSpec diagnostics.
.../encoded-model-property-body/validator-diagnostics.json Captures validator results.
.../empty-enum-body/main.tsp Defines the empty-enum case.
.../empty-enum-body/output.json Captures emitted OpenAPI.
.../empty-enum-body/expect.json Declares expected compliance.
.../empty-enum-body/tsp-diagnostics.json Captures TypeSpec diagnostics.
.../empty-enum-body/validator-diagnostics.json Captures validator results.
.../empty-encoded-scalar-body/main.tsp Defines schema-less encoding cases.
.../empty-encoded-scalar-body/output.json Captures emitted OpenAPI.
.../empty-encoded-scalar-body/expect.json Declares expected compliance.
.../empty-encoded-scalar-body/tsp-diagnostics.json Captures TypeSpec diagnostics.
.../empty-encoded-scalar-body/validator-diagnostics.json Captures validator results.
Suppressed comments (1)

packages/typespec-lintdiff/test/fixtures/ParametersSchemaAsTypeObject/rule.md:54

  • The expected result here should be “follow the resolved schema,” not unconditional pass. The listed fixture only proves untyped-scalar and object-union references; add a referenced standard-based scalar control that violates, otherwise the matrix's claimed coverage omits this reachable branch.
| encoded model property backed by a referenced scalar or named union, including nullable wrappers                                             | `$ref` plus sibling encoded type; validator resolves the reference | pass                 | `encoded-model-property-body`                      |

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +197 to +203
if (mergedFormat && isSupportedAutorestFormat(mergedFormat)) {
schema = {
hasType: encodedSchema.hasType,
format: mergedFormat,
};
}
}
Comment on lines +28 to +29
- an encoded model-property body backed by a referenced scalar should pass because validator
reference resolution hides the sibling encoded type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants