Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GET /ping is missing content object in the OAS #1754

Closed
Alan-Cha opened this issue Sep 24, 2018 · 1 comment
Closed

GET /ping is missing content object in the OAS #1754

Alan-Cha opened this issue Sep 24, 2018 · 1 comment

Comments

@Alan-Cha
Copy link
Contributor

Alan-Cha commented Sep 24, 2018

Description

The a new LoopBack app automatically creates a GET /ping operation but the operation is missing a content object, aka media type object.

Step to reproduce

Create a new Loopback project, start the API, and find the OAS (go to http://localhost:3000/openapi.json).

lb4 app
cd [app name]
npm start

Current behavior

"/ping": {
      "get": {
        "x-controller-name": "PingController",
        "x-operation-name": "ping",
        "tags": [
          "PingController"
        ],
        "responses": {
          "200": {
            "description": "Return value of PingController.ping"
          }
        }
      }
    }
  }

Expected behavior

"/ping": {
  "get": {
    "x-controller-name": "PingController",
    "x-operation-name": "ping",
    "tags": [
      "PingController"
    ],
    "responses": {
      "200": {
        "description": "Return value of PingController.ping",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "greeting": {
                  "type": "string"
                },
                "date": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "headers": {
                  "type": "object",
                  "properties": {
                    "cache-control": {
                      "type": "string"
                    },
                    "postman-token": {
                      "type": "string"
                    },
                    "user-agent": {
                      "type": "string"
                    },
                    "accept": {
                      "type": "string"
                    },
                    "host": {
                      "type": "string"
                    },
                    "accept-encoding": {
                      "type": "string"
                    },
                    "connection": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

In theory you should just be able to copy and paste the content object into the template but I am unsure of the data types for cache-control, postmanToken, and userAgent.

@raymondfeng
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants