Skip to content

swagger_url doesn't seem to get parsed from extra: in mkdocs.yml #6

@zeigerpuppy

Description

@zeigerpuppy

I have set up the mkdocs-swagger-plugin to call my local https://server.net/swagger.json but the script fails on exception:

TypeError: swagger.paths[path] is undefined

My config in mkdocs.yml is:

plugins:
  - swagger
extra:
   swagger_url: 'https://server.net/swagger.json'

and the page being rendered has:

!!GET /users/{id}!!

looking at the function call, it is:

function findApiFromSwagger(swagger, method, path) {
  'use strict'
  return swagger.paths[path][method.toLowerCase()]
}

this seems to be using the object:

swagger: Object: "2.0", host": "petstore.swagger.io", "basePath": "/v2", ...} 
method: "GET" 
path: "users/{id}"

This suggests that the plugin is not setting SWAGGER_URL properly and instead is using the default:

const SWAGGER_URL = 'https://petstore.swagger.io/v2/swagger.json'

I'm not quite sure how I should fix it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions