Forum Discussion

sandesh007's avatar
sandesh007
Occasional Contributor
9 years ago

The interactive forms are disabled, as no `host` property was found in the specification

When importing API I am getting error as "The interactive forms are disabled, as no `host` property was found in the specification. Please see: OAI 2.0/#swagger-object" And I dont know where to add host config in yaml file.

  • Hi!

     

    Thanks for reaching out.

    Short answer? Its a root level property.  

    Longer answer...

    The host property is meant to identify the host of the API, without the schema or any URIs.

     

     

    Something like...

     

     

    swagger: '2.0'  # I'm a swagger document
    host: petstore.swagger.io  # The host of the API
    schemes:
      - http  # Only served over HTTP, not HTTPS
    basePath: /v2  # Optional basePath, that all paths fall under
    paths:
      # ... your paths / endpoints

    Here is a functional example, to better illustrate ...

     

    https://swaggerhub.com/api/ponelat/findByStatus/1

     

    Happy coding!

    Feel free to bug us, if something isn't working. 

     

    Josh

  • Regarding your spec...

    Host is correct... but you do have two 'basePath' properties. YAML is like JSON, in that it doesn't know what to do with two :)

    I'm guessing the `basePath: /api` is the correct one, not the `basePath: /v1` on line 37?

  • Hi!

     

    Thanks for reaching out.

    Short answer? Its a root level property.  

    Longer answer...

    The host property is meant to identify the host of the API, without the schema or any URIs.

     

     

    Something like...

     

     

    swagger: '2.0'  # I'm a swagger document
    host: petstore.swagger.io  # The host of the API
    schemes:
      - http  # Only served over HTTP, not HTTPS
    basePath: /v2  # Optional basePath, that all paths fall under
    paths:
      # ... your paths / endpoints

    Here is a functional example, to better illustrate ...

     

    https://swaggerhub.com/api/ponelat/findByStatus/1

     

    Happy coding!

    Feel free to bug us, if something isn't working. 

     

    Josh