I used the Spring REST service implementation to learn Swagger.
Service on GET - http://localhost:8080/greeting?name=Betlista returns
{
"id":5,
"content":"Hello, Betlista!"
}
So I created YAML file for Swagger as:
swagger: "2.0"
info:
version: "0.0.1-SNAPSHOT"
title: "Spring REST"
host: "localhost:8080"
basePath: "/"
tags:
- name: "Greeting"
schemes:
- "http"
paths:
/greeting:
get:
operationId: "greeting"
produces:
- "application/json"
parameters:
- name: "name"
in: "query"
required: false
type: "string"
responses:
"200":
description: "successful operation"
schema:
$ref: "#/definitions/GreetingResponse"
definitions:
GreetingResponse:
type: "object"
properties:
id:
type: "integer"
content:
type: "string"
The problem is, when I tried to execute it using "Try it out" button.
It seems (from Chrome's Network tab in developer tools) like there is no response:
...while regular call in browser works fine
edit: as I mentioned in comments, I verified curl generated by swagger and it works as expected - curl -X GET "http://localhost:8080/greeting?name=Betlista" -H "accept: application/json"
At the moment I'm looking into CORS topic (which makes no sense to me as documentation and service are both on localhost), I see in Chrome console this: