swagger-api/swagger-codegen

Swagger ignores vendorextention for $ref type properties

Open

#2,219 建立於 2016年2月23日

在 GitHub 查看
 (11 留言) (0 反應) (0 負責人)HTML (5,474 fork)batch import
Issue: Bughelp wanted

倉庫指標

Star
 (12,701 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

Hi @wing328 ,

Swagger ignores vendorextention for $ref type properties. For e.g. If there is a property as follows in yaml

  myObject:
       properties:
               myid:
                  type: int
                  x-app-extensions: {"aaid" : "bb", "ccid" : "dd"}
errors:
                   x-app-extensions: {"aaerr" : "bb", "ccerr" : "dd"}
    $ref: "#/definitions/errorModel"

Then, swagger model ignores vendorextensions for errors, and only has only $ref property in the parsed json node, and same in reflected in created java model. But, vendorextenion is correctly picked up for myid. The ignorance of vendor extension is due to an issue in following snippet of the code of io.swagger.util.PropertyDeserializer.propertyFromNode(JsonNode) method.

   JsonNode detailNode = node.get("$ref");
  if (detailNode != null) {
      return new RefProperty(detailNode.asText()).description(description);
  }

Is it expected that, $ref type nodes are not supposed to have any other properties?

貢獻者指南