我以以下方式编写了一个swagger文件:
swagger: "2.0"
info:
version: "0.0.1"
title: API Specification 116
# during dev, should point to your local machine
host: localhost
# basePath prefixes all resource paths
basePath: /
#
schemes:
# tip: remove http to make production-grade
- http
- https
# format of bodies a client can send (Content-Type)
consumes:
- application/json
# format of the responses to the client (Accepts)
produces:
- application/json
x-a127-config: {}
x-volos-resources: {}
paths:
/v1/customers/{customer_id}/summary :
#/welcome:
# binds a127 app logic to a route
#x-swagger-router-controller: summary
#x-volos-authorizations: {}
#x-volos-apply: {}
get:
description: ""
operationId: summary
parameters:
- name: customer_id
in: path
description: "The desired customer information"
required: true
type: "string"
responses:
"200":
description: Success
schema:
# a pointer to a definition
$ref: CustomerSummaryResponse
# responses may fall through to errors
default:
description: Error
schema:
$ref: ErrorResponse
# complex objects have schema definitions
definitions:
CustomerSummaryResponse:
properties:
id:
type: string
firstName:
type: string
middleName:
type: string
lastName:
type: string
email:
type: string
role:
type: string
tenure:
type: string
msidn:
type: string
accountId:
type: string
addresses:
type: object
properties:
type:
type: string
addressLine1:
type: string
addressLine2:
type: string
cityName:
type: string
stateCode:
type: string
zip:
type: string
zipExt:
type: string
accounts:
type: object
properties:
id:
type: string
type:
type: string
category:
type: string
name:
type: string
numberOfLines:
type: number
ErrorResponse:
required:
- message
properties:
message:
type: string在此之后,我想在我的机器上运行这个本地模拟程序,所以我做了a127项目start -m,然后我做了一个curl,即:
curl -i http://localhost:10010/v1/customer/12134/summary我发现curl命令返回
C:\Apigee127>curl -i http://localhost:10010/welcome
curl: (7) Failed connect to localhost:10010; No error我一开始以为港口有问题,但不确定有什么建议吗?
发布于 2014-11-26 23:45:17
试试这个:
curl -4 -i http://localhost:10010/v1/customer/12134/summary它将迫使curl使用IPv4而不是IPv6。
史考特
https://stackoverflow.com/questions/27158096
复制相似问题