{
"apiVersion": "1.0.0",
"swaggerVersion": "1.2",
"basePath": "http://localhost:9999/lazydoc-spring",
"resourcePath": "/customers",
"apis": [
{
"path": "/customers",
"description": "Creates a new customer",
"operations": [
{
"method": "POST",
"nickname": "createCustomer",
"type": "Customer",
"summary": "Creates a new customer",
"notes": "",
"authorization": {
},
"errorResponses": [],
"parameters": [
{
"paramType": "body",
"name": "requestBody",
"description": "The data of the customer to be created",
"type": "Customer",
"required": true,
"allowMultiple": false,
"list": false
}
],
"responseMessages": [
{
"code": 400,
"message": "Invalid ID supplied"
},
{
"code": 404,
"message": "Pet not found"
},
{
"code": 405,
"message": "Validation exception"
}
]
}
]
},
{
"path": "/customers/{customerId}",
"description": "Deletes the customer for the given id",
"operations": [
{
"method": "DELETE",
"nickname": "deleteCustomer",
"responseClass": "void",
"parameters": [
{
"paramType": "path",
"name": "customerId",
"description": "The id of the customer to be updated",
"type": "long",
"required": true,
"allowMultiple": false,
"list": false
}
],
"summary": "Deletes the customer for the given id",
"notes": "",
"authorization": "",
"errorResponses": []
}
]
},
{
"path": "/customers/{customerId}",
"description": "Returns the customer for the given id",
"operations": [
{
"method": "GET",
"nickname": "getCustomer",
"responseClass": "Customer",
"parameters": [
{
"paramType": "path",
"name": "customerId",
"description": "The id of the customer to be updated",
"type": "long",
"required": true,
"allowMultiple": false,
"list": false
}
],
"summary": "Returns the customer for the given id",
"notes": "",
"authorization": "",
"errorResponses": []
}
]
},
{
"path": "/customers",
"description": "Returns all customers",
"operations": [
{
"method": "GET",
"nickname": "getCustomers",
"responseClass": "List[Customer]",
"parameters": [
],
"summary": "Returns all customers",
"notes": "",
"authorization": "",
"errorResponses": []
}
]
},
{
"path": "/customers/{customerId}",
"description": "Updates a customer specified by the id",
"operations": [
{
"method": "PUT",
"nickname": "updateCustomer",
"responseClass": "Customer",
"parameters": [
{
"paramType": "path",
"name": "customerId",
"description": "The id of the customer to be updated",
"type": "long",
"required": true,
"allowMultiple": false,
"list": false
}
,
{
"paramType": "form",
"name": "requestBody",
"description": "The data of the customer to be created",
"type": "Customer",
"required": true,
"allowMultiple": false,
"list": false
}
],
"summary": "Updates a customer specified by the id",
"notes": "",
"authorization": "",
"errorResponses": []
}
]
} ],
"models": {
"Customer": {
"properties": {
"city": {
"type": "String",
"description": "The city of the customer's address",
"required": false,
"request": true,
"response": true,
"list": false
},
"customerId": {
"type": "long",
"description": "The unique identifier of the customer",
"required": false,
"request": true,
"response": true,
"list": false
},
"firstname": {
"type": "String",
"description": "The firstname of the customer",
"sample": "Maxi",
"required": false,
"request": true,
"response": true,
"list": false
},
"lastname": {
"type": "String",
"description": "The lastname of the customer",
"sample": "Miller",
"required": false,
"request": true,
"response": true,
"list": false
},
"street": {
"type": "String",
"description": "The street of the customer's address",
"sample": "Effnerstr. 5",
"required": false,
"request": true,
"response": true,
"list": false
},
"zipCode": {
"type": "String",
"description": "The zipcode of the customer's address",
"required": false,
"request": true,
"response": true,
"list": false
}
}
}
}
}--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Headers", "x-requested-with");
I have a generator to produce the SWAGGER documentation.
--
You received this message because you are subscribed to a topic in the Google Groups "Swagger" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/swagger-swaggersocket/uzZs8j1dvoQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to swagger-swaggers...@googlegroups.com.
http://localhost:9999/lazydoc-spring/customersPragma: no-cache Content-Type: application/json Cache-Control: no-cache, no-store, max-age=0, must-revalidate Expires: 0
OPTIONS /lazydoc-spring/customers HTTP/1.1 Host: localhost:9999 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:33.0) Gecko/20100101 Firefox/33.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: de,en-US;q=0.7,en;q=0.3 Accept-Encoding: gzip, deflate Origin: http://localhost:9990 Access-Control-Request-Method: GET Access-Control-Request-Headers: content-type Connection: keep-alive
And this is answered by the server:
HTTP/1.1 200 OK Server: Apache-Coyote/1.1 access-control-allow-origin: * Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE Access-Control-Max-Age: 3600 Access-Control-Allow-Headers: x-requested-with X-Content-Type-Options: nosniff X-XSS-Protection: 1; mode=block Cache-Control: no-cache, no-store, max-age=0, must-revalidate Pragma: no-cache Expires: 0 x-frame-options: DENY Allow: GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, PATCH Content-Length: 0 Date: Sun, 09 Nov 2014 19:46:56 GMT
Happy to hear! Feel free to ask any other questions.
--
That's just how CORS works. When you post a body it must do a preflight check via options. Posting with www-form-urlencoded will not
--
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.