Skip to content

Make requestBody for create operation optional #204

Open
@dlorych

Description

@dlorych

Use Cases or Problem Statement

In my case a creation of the resource has only a POST method without a requestBody. The object is generated randomly on the server side and returned in the response body.

I can see DESIGN.md specifies clearly, that create with request body is the only schema required for resources.

When trying to generate the code, the resource is skipped due to above requirement - missing requestBody.

Proposal

To my understanding, as long as there's a schema body in either request or response the resource mapping shall work.

The proposal is to modify resource_mapper::generateResourceSchema function:

  1. for create request body - in case of missing schema do not return error, but set createRequestAttributes to empty list
  2. for create response body - leave as it is
  3. merge two sets of attributes and return error if the merged set is empty.

Additional Information

I have a limited knowledge about the context, it's probably not seeing a big picture / all implications. It would be great if you could explain the rationale behind this requirement if it is a hard requirement.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions