0

我在环回 4 中完成了这个模型:

@property({
    type: 'string',
    id: true,
    default: () => uuid(),
  })

  id: string;

  @property({
    type: 'string',
    required: true,
  })
  name: string;

如您所见,默认情况下会生成 id。但是在环回/资源管理器中

图像浏览器

出现标识。我想隐藏它,如果它是自动生成的,它可能会给想要使用这个 API 的开发人员带来混乱。任何人都知道如何将属性放入模型中,并将其隐藏在/explorer?

谢谢。

4

2 回答 2

1

只需从请求正文模式中排除 id

@requestBody({
      content: {
        'application/json': {
          schema: getModelSchemaRef(Model, {exclude: ['id']}),
        },
      },
    }

希望这有帮助 谢谢

于 2019-10-18T10:58:28.200 回答
0

你可以试试这样:-

@model({
  settings: {hidden: ['password']}
})
class User extends Entity {
  // ...
  @property({
    type: 'string',
    required: true
  })
  password: string;
}
于 2019-07-18T07:37:48.090 回答