feat(openapi): document request bodies and real HTTP methods from handler schemas#159
Merged
Merged
Conversation
Close three gaps that kept handler validation and metadata from reaching the rendered OpenAPI docs: - REST resources (*.rest.ts) now resolve a write-side schema for create/update/patch bodies from an exported inputSchema/patchSchema, or derive one from the entity schema by omitting the primary key and timestamp fields. The OpenAPI requestBody stops leaking id/timestamps. - The procedure docs loop respected only POST and always attached a body. It now honours meta.httpMethod and only emits a requestBody for body-carrying verbs. - meta.summary and meta.tags were dropped during fs-discovery and the generator reused meta.description as the summary. summary/description now map to their own OpenAPI fields and tags propagate end-to-end. Adds rest-loader write-schema unit coverage and generator cases for HTTP method and summary/description mapping.
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.
Problema
Na doc renderizada, endpoints REST/handlers de criação não mostravam o body nem a validação do body, e descrições/tags definidas no handler não chegavam ao OpenAPI.
Mudanças (3 lacunas)
A —
*.rest.tsalimenta orequestBodycom o schema certoRestExportsganhouinputSchema?epatchSchema?.inputSchemaexportado ou deriva deschemaomitindoprimaryKey+createdAt/updatedAt. Patch virapartial()quando não hápatchSchema.requestBodypara de vazar a entidade inteira (id/timestamps).B — gerador respeita o método HTTP real
meta.httpMethode só emiterequestBodyparapost/put/patch.C —
summary/description/tagsnos campos certosdiscovery-utilsagora propagasummaryetags(antes sódescription).summaryedescriptionpara campos OpenAPI distintos;tagspreferemmeta.tags.Verificação
tsc --noEmitlimpo.rest-loader-input-schema.unit.test.ts(4 casos).