camel-swagger를 사용하여 서비스의 API 정의를 생성하고 있습니다. 생성 된 자신감 정의를 검색 -Camel에서 생성 된 camel specific 속성을 제거합니다.
{
"swagger" : "2.0",
"info" : {
"description" : "api.description",
"version" : "1.0",
"title" : "api.title",
"termsOfService" : "api.termsOfService",
"contact" : {
"name" : "api.contact.name",
"url" : "http://api.contact.url",
"email" : "[email protected]"
},
"license" : {
"name" : "api.license.name",
"url" : "http://api.license.url"
}
},
"host" : "0.0.0.0:13000",
"basePath" : "/airportinfo-service/1.0",
"tags" : [ {
"name" : "airports"
} ],
"schemes" : [ "http" ],
"paths" : {
"/airports" : {
"get" : {
"tags" : [ "airports" ],
"parameters" : [ ],
"responses" : {
"200" : {
"description" : "Output type",
"schema" : {
"$ref" : "#/definitions/Airports"
}
}
},
"x-camelContextId" : "airportinfo-service",
"x-routeId" : "getAirports"
}
},
"/airports/{id}" : {
"get" : {
"tags" : [ "airports" ],
"parameters" : [ {
"name" : "id",
"in" : "path",
"description" : "",
"required" : true,
"type" : "string"
} ],
"responses" : {
"200" : {
"description" : "Output type",
"schema" : {
"$ref" : "#/definitions/Airport"
}
}
},
"x-camelContextId" : "airportinfo-service",
"x-routeId" : "getAirport"
}
},
"/airports/health" : {
"get" : {
"tags" : [ "airports" ],
"parameters" : [ ],
"responses" : {
"200" : {
"description" : "Output type",
"schema" : {
"type" : "string",
"format" : "java.lang.String"
}
}
},
"x-camelContextId" : "airportinfo-service",
"x-routeId" : "health"
}
}
},
"definitions" : {
"Airport" : {
"type" : "object",
"properties" : {
"id" : {
"type" : "integer",
"format" : "int64"
},
"airportIataCode" : {
"type" : "string"
},
"airportName" : {
"type" : "string"
},
"airportStatus" : {
"type" : "string"
},
"airportLatitude" : {
"type" : "number",
"format" : "double"
},
"airportLongitude" : {
"type" : "number",
"format" : "double"
},
"airportUrl" : {
"type" : "string"
},
"cityId" : {
"type" : "integer",
"format" : "int64"
},
"cityIataCode" : {
"type" : "string"
},
"cityName" : {
"type" : "string"
},
"cityLatitude" : {
"type" : "number",
"format" : "double"
},
"cityLongitude" : {
"type" : "number",
"format" : "double"
},
"cityStatus" : {
"type" : "string"
},
"cityCategory" : {
"type" : "string"
},
"countryId" : {
"type" : "integer",
"format" : "int64"
},
"countryIataCode" : {
"type" : "string"
},
"countryName" : {
"type" : "string"
},
"region" : {
"type" : "string"
}
},
"x-className" : {
"type" : "string",
"format" : "demo.service.composite.airportinfo.datatypes.Airport"
}
},
"Airports" : {
"type" : "object",
"properties" : {
"size" : {
"type" : "integer",
"format" : "int32"
},
"airports" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/Airport"
}
}
},
"x-className" : {
"type" : "string",
"format" : "demo.service.composite.airportinfo.datatypes.Airports"
}
}
}
}
상기 API의 정의는 생성하는 코드 -
restConfiguration()
.component("{{server.component}}")
.host("{{server.host}}")
.port("{{server.port}}")
.bindingMode(RestBindingMode.json)
.dataFormatProperty("prettyPrint", "true")
.contextPath("/{{service.name}}/{{service.version}}")
.apiContextPath("/")
.apiProperty("api.title", "{{api.title}}")
.apiProperty("api.version", "{{service.version}}")
.apiProperty("api.description", "{{api.description}}")
.apiProperty("api.termsOfService", "{{api.termsOfService}}")
.apiProperty("api.contact.name", "{{api.contact.name}}")
.apiProperty("api.contact.email", "{{api.contact.email}}")
.apiProperty("api.contact.url", "{{api.contact.url}}")
.apiProperty("api.license.name", "{{api.license.name}}")
.apiProperty("api.license.url", "{{api.license.url}}")
.apiProperty("apiContextIdListing", "{{apiContextIdListing}}")
.apiProperty("apiContextIdPattern", "{{apiContextIdPattern}}");
rest("/airports")
.get()
.id("getAirports")
.outType(Airports.class)
.to("direct:getAirports")
.get("/{id}")
.id("getAirport")
.outType(Airport.class)
.to("direct:getAirport")
.get("/health")
.id("health")
.outType(String.class)
.to("direct:health");
지금, 내가 AWS API 게이트웨이에서이 정의를 가져올를.
"x-className" : {
"type" : "string",
"format" : "demo.service.composite.airportinfo.datatypes.Airport"
}
이
"x-className" : {
"type" : "string",
"format" : "demo.service.composite.airportinfo.datatypes.Airports"
}
필요를 제거해야 제거 할
필요 - 그러나, 같은 때문에 위에서 주어진 API 정의에서 다음과 같은 부분으로 받아 들여지고 있지 않습니다 바꾸려면
"schema" : { "type" : "string", "format" : "java.lang.String" }
"schema" : { "format" : "String" }
, 나는 쉽게 AWS API 게이트웨이의 정의를 가져올 수 있어요.
camel-swagger를 사용하여 생성 된 swagger 정의에서 Camel 특정 속성을 억제하는 방법이 있습니까?
감사합니다.