OpenAPITools / OpenAPITools/openapi-generator

If the member variable in yaml is required, will the generated code verify whether the parameter is passed?

Open
#12,447 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

If the member variable in yaml is required, will the generated code verify whether the parameter is passed?

For example, the following is a section in my yaml, in which the three parameters of GroupId, Members_Account, ShutUpTime are required, but after the code is actually generated, I test the request and find that even if I do not pass these three parameters, the request will be sent

    ForbidSendMsgRequest:
      type: object
      required:
        - GroupId
        - Members_Account
        - ShutUpTime
      properties:
        GroupId:
          type: string
          description: 需要查询的群组 ID
        Members_Account:
          type: array
          description: 需要禁言的用户帐号,最多支持500个帐号
          maxItems: 500
          items:
            type: string

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior with the supplied ForbidSendMsgRequest YAML and inspect the generated client request path. Determine where required parameters are handled, then verify that omitting GroupId, Members_Account, or ShutUpTime prevents the request from being sent.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.