首页 > 解决方案 > JsonIgnore 使用开放 API 规范

问题描述

我使用OpenAPI规范来生成 Java POJO。我需要在 Open API yaml 中指定什么来生成与以下 POJO 等效的内容?

...
@JsonIgnore
public String ignoredProperty;
...

我有如下的yaml规范

openapi: 3.0.0
info:
  title: Cool API
  description: A Cool API spec
  version: 0.0.1
servers:
  - url: http://api.cool.com/v1
    description: Cool server for testing
paths:
  /
  ...
components:
  schemas:
    MyPojo:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        # I want the below attribute to be ignored as a part of JSON 
        ignoreProperty:  
          type: string  

标签: javaswaggeropenapiopenapi-generator

解决方案


推荐阅读