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
Allow Controller methods implementing PATCH operation to describe their input data as "a model with all properties optional". This story requires #2629 and #2631 to be implemented first.
To emit schema with optional model properties, we should add a new schema-generation option called partial.
exportinterfaceJsonSchemaOptions{/// Make all properties optionalpartial?: boolean;}
An example showing a controller method accepting a partial model instance:
classTodoListController{// ...
@patch('/todo-lists/{id}',{responses: {// left out for brevity},})asyncupdateById(
@param.path.number('id')id: number,
@requestBody({content: {'application/json': {schema: getModelSchemaRef(TodoList,{partial: true}),/***** ^^^ THIS IS IMPORTANT - OPENAPI SCHEMA ^^^ ****/},},})obj: Partial<TodoList>,/***** ^^^ THIS IS IMPORTANT - TYPESCRIPT TYPE ^^^ ****/): Promise<void>{awaitthis.todoListRepository.updateById(id,obj);}}
See 887ae84 for a spike showing proposed implementation details.
Allow Controller methods implementing PATCH operation to describe their input data as "a model with all properties optional". This story requires #2629 and #2631 to be implemented first.
To emit schema with optional model properties, we should add a new schema-generation option called
partial
.An example showing a controller method accepting a partial model instance:
See 887ae84 for a spike showing proposed implementation details.
Acceptance criteria
PATCH
endpoints in all example applications are updated to leveragapartial
option and usePartial<MyModel>
as the type of the controller method argument accepting model data - see Emit schema with all model properties optional + allow partial updates via PATCH #3199Partial
#1179, either close them as fixed or post a comment explaining what's remaining to be done.The text was updated successfully, but these errors were encountered: