minchao / go-ptx Goto Github PK
View Code? Open in Web Editor NEW公共運輸整合資訊流通服務平臺(Public Transport Data eXchange,PTX)的非官方 Golang 用戶端程式庫
License: BSD 2-Clause "Simplified" License
公共運輸整合資訊流通服務平臺(Public Transport Data eXchange,PTX)的非官方 Golang 用戶端程式庫
License: BSD 2-Clause "Simplified" License
Error:
$ swagger generate client -f ./oas.rail.v2.json -t ./rail/v2
2019/07/16 00:12:47 validating spec ./oas.rail.v2.json
The swagger spec at "./oas.rail.v2.json" is invalid against swagger specification 2.0. see errors :
- "LineColor" is present in required but not defined as property in definition "Service.DTO.Version2.Rail.TRA.Line"
僅提供台南市公車資料。
執行 swagger generate 時拋出型別錯誤。
錯誤訊息:
$ swagger generate client -f ./oas.bike.json -t ./bike
2019/07/14 17:46:36 validating spec ./oas.bike.json
The swagger spec at "./oas.bike.json" is invalid against swagger specification 2.0. see errors :
- default value for $top in query does not validate its schema
- $top in query must be of type string: "number"
原因:
在 PTX 的 OAS 的定義中,$top
的型別為 string,但預設值卻是 integer 的 30
:
{
"name": "$top",
"in": "query",
"description": "取前幾筆",
"type": "string",
"default": 30
}
處理方式:
先回報官方,在官方修正前,將預設值改為 string。
查詢時發生錯誤:
panic: json: cannot unmarshal number into Go struct field ServiceDTOVersion2BikeBikeAvailability.ServieAvailable of type string
原因:
ServieAvailable
的 type 定義為 string,但返回值為 integer。enum
定義錯誤,假設返回值正確,則應為 "enum": [0, 1]
。定義
"ServieAvailable": {
"description": "服務狀態",
"enum": [
"0: 停止營運",
"1: 正常營運"
],
"type": "string"
}
回應
"ServieAvailable": 1,
處理方式:
已回報官方。
Describe the bug
/v3/Bus/Schedule/City/{City}.get.parameters 缺少 enum 成員
"parameters": [
{
"name": "City",
"in": "path",
"description": "縣市",
"required": true,
"type": "string",
"enum": [],
"x-enum": {
"Tainan": "臺南市"
}
}
]
應為:
"enum": [
"Tainan"
]
To Reproduce
$ make spec
$ make validate
The swagger spec at "./oas.bus.v3.json" is invalid against swagger specification 2.0.
See errors below:
- "paths./v3/Bus/Schedule/City/{City}.get.parameters" must validate one and only one schema (oneOf). Found none valid
- paths./v3/Bus/Schedule/City/{City}.get.parameters.in in body should be one of [header]
- paths./v3/Bus/Schedule/City/{City}.get.parameters.enum in body should have at least 1 items
Additional context
已回報,等 PTX 修正。
Describe the bug
The swagger spec at "./oas.rail.v2.json" is invalid against swagger specification 2.0.
See errors below:
- "THSRApi_AvailableSeatStatusList_1" is defined 2 times
- "THSRApi_AvailableSeatStatusList" is defined 2 times
- "SrcUpdateTime" is present in required but not defined as property in definition "Service.DTO.Version2.Rail.THSR.AvailableSeat"
已回報 PTX
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.