serverless-aws-documentation icon indicating copy to clipboard operation
serverless-aws-documentation copied to clipboard

Documentation does not propagate `info`

Open jhaagmans opened this issue 6 years ago • 7 comments

The documentation clearly states that the version and title parameters of the info block are not propagated to the output Swagger file. However, I noticed that I can't get any of the block to be propagated. This is an example serverless.yml:

service: test

provider:
  name: aws
  runtime: nodejs6.10
  stage: ${opt:stage, 'development'}
  region: eu-west-1
  profile: ${self:provider.stage}

functions:
  test:
    handler: test.handler
    events:
      - http:
          method: get
          path: test

custom:
  documentation:
    info:
      version: "0.0.1"
      title: "Test API"
      description: "Test everything"
      termsOfService: "https://www.google.com"
      contact:
        name: "Jaap Haagmans"

And this is the output:

---
swagger: "2.0"
info:
  version: "2018-04-23T15:30:42Z"
  title: "production-test"
host: "###"
basePath: "/production"
schemes:
- "https"
paths:
  /test:
    get:
      responses: {}

What am I doing wrong?

jhaagmans avatar Apr 23 '18 15:04 jhaagmans

I'm seeing the same thing. custom.documentation.info.description is not showing up, which is quite annoying.

icj217 avatar May 01 '18 20:05 icj217

I tried to fix this by creating a DocumentationPart resource with Type API, but I ran into these problems in CloudFormation:

https://forums.aws.amazon.com/thread.jspa?messageID=871765

kennu avatar Oct 09 '18 21:10 kennu

Same here to me. All of parameter in custom.documentation.info is ignored. What can I do?

jormal avatar Mar 18 '19 07:03 jormal

@jhaagmans Any suggestions for alternatives?

kennu avatar Mar 18 '19 13:03 kennu

Wow, I messed up. I've used 2 similar plugins, the other one is temando/serverless-openapi-documentation for which my previous comment was relevant (I removed the comment). This plugin is obviously not dead and unmaintained (unlike the other one), the problem mentioned here is not fixed though, but I'm not sure whether this is just a shortcoming in the API Gateway API or a bug in this plugin. I'm so sorry for the confusion, I got a notification and jumped the gun.

jhaagmans avatar Mar 18 '19 19:03 jhaagmans

The documentation is incorrect. One needs to insert an extra api level between documentation and info. See https://github.com/deliveryhero/serverless-aws-documentation/blob/master/example/serverless.yml#L23

So, for the example in the author's code snippet should change to...

custom:
  documentation:
    api:
      info:
        version: "0.0.1"
        title: "Test API"
        description: "Test everything"
        termsOfService: "https://www.google.com"
        contact:
          name: "Jaap Haagmans"

halprin avatar Aug 12 '19 23:08 halprin

@halprin Thanks!!!

jormal avatar Aug 14 '19 10:08 jormal