Skip to content

[Core] Created non-templated response schemas to support versioning #960

Description

@widal001

Summary

Problem: When TypeSpec models have templates (e.g. Ok<T> or Paginated<T>) they don't get emitted as JSON schemas by TypeSpec. This makes it hard to document changes to those fields, like #959, in our schema changelog and generate the correct documentation for them.

Recommendation: The CommonBenefits core library demonstrates how to solve this problem using a combination of base, templated, and non-templated schemas to solve this problem by:

Examples

Acceptance criteria

  • These base response schemas (e.g. Ok, Paginated, Filtered, etc.) now have JSON schemas generated for them
  • These base response schemas have been added to the website docs for responses with versioning, starting with the version in which their templated equivalent was added (so v0.1.0 for most)
  • The templated versions of these schemas are now suffixed with T (e.g. OkT) and are still used to generate response bodies for the routes
  • The approach to implementing this either closely matches the CommonBenefits protocol, or the PR explains why an easier option exists (e.g. TypeSpec now supports this natively through tsconfig.json -- though I don't think they do at the moment)

Metadata

Metadata

Labels

No labels
No labels

Type

Fields

No fields configured for Task.

Projects

Status
In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions