2017-10-09 63 views
0

我正在尝试测试Saber CreatePassengerNameRecord rest API的集成。作为第一步,我尝试下载Request和Response的JSON模式,并尝试使用jsonschema2pojo生成POJO。但是它看起来像架构文件都使用不存在的URL http://services.sabre.com指向依赖引用。因此,POJO一代正在失败。对于请求和响应都发生这种情况。通过将XMLSchemaTypes.json依赖项的URL更改为文档中提供的URL链接,我能够修复请求模式,但响应中有一个引用,它在任何地方都没有指定(请检查响应模式问题部分)。REST JSON的架构无效CreatePassengerNameRecord响应

API链接:https://developer.sabre.com/docs/rest_apis/air/book/create_passenger_name_record/

响应架构:

在响应中,存在要http://services.sabre.com/STL_Payload/v02_02参考未现有。

文件:http://files.developer.sabre.com/doc/providerdoc/STPS/create_passenger_name_record/v200/CreatePassengerNameRecord2.0.0RS.json

.... 
"CreatePassengerNameRecordRS" : { 
     "type" : "object", 
     "title" : "CreatePassengerNameRecordRS", 
     "properties" : { 
     "version" : { 
      "type" : "string", 
      "minLength" : 1, 
      "maxLength" : 255 
     }, 
     "ApplicationResults" : { 
      "$ref" : "http://services.sabre.com/STL_Payload/v02_02#/definitions/ApplicationResults" 
.... 

这将是巨大的它,你可以提供的STL_Payload最新的文件或更新文件到最新的工作版本。

回答

1

将丢失的文件添加到文档页面。 这应该让你前进。 这些id-s仍然用作标记而不是绝对资源指针,因此您仍然需要按照您所描述的方式使用它,以使自动生成功能立即可用。 我们会考虑您的请求,将它们转换为资源指针。 只要再一个提示:如果您使用jsonschema2pojo的Java的API版本,请用这个配置:

GenerationConfig config = new DefaultGenerationConfig() { 
    public String getRefFragmentPathDelimiters() { 
     return "#/"; 
    } 
}; 

你需要它,因为在jsonschema2pojo默认路径分隔符是“#/。”和“。”不适用于架构中声明的某些类型,如Text.Long