1

Schema 是使用 @ApiBody({type:CreateUserInput}) 实现的,我需要能够通过设置 additionalPropeerties:false 来防止它根据 OPENAAPI 规范接受其他属性,但我不知道如何实现它。

"schemas": {
      "CreateUserInput": {
        "type": "object",
        "properties": {
          "firstName": {
            "type": "string",
            "description": "for firstname",
            "pattern": "^[A-Za-z0-9]{3,10}$",
            "maxLength": 50,
            "minLength": 10
          },
          "lastName": {
            "type": "string",
            "description": "for email",
            "pattern": "^[A-Za-z0-9]{3,10}$",
            "maxLength": 50,
            "minLength": 10
          },
          "email": {
            "type": "string",
            "description": "for email",
            "pattern": "^[A-Za-z0-9]{3,10}$",
            "maxLength": 50,
            "minLength": 10
          },
          "password": {
            "type": "string",
            "minLength": 10,
            "maxLength": 50,
            "description": "for email",
            "pattern": "^[A-Za-z0-9]{3,10}$"
          }
        },
        "required": ["firstName", "lastName", "email", "password"]
      },```

4

0 回答 0