danielgtaylor / aglio

An API Blueprint renderer with theme support that outputs static HTML
4.75k stars 481 forks source link

Hello world rendered instead of response body #221

Closed alex88 closed 8 years ago

alex88 commented 8 years ago

I've this response blueprint:

+ Response 400

    + Attributes
        + error_code (string) - Error code
        + error (string) - Error
        + error_description (string) - Error description
        + error_message (string) - Error message

    + Body

            {
                "error_code": "xxx",
                "error": "xxx"
                "error_description": "xxx"
                "error_message": "xxx"
            }

however aglio renders:

Body

{
  "error_code": "Hello, world!",
  "error": "Hello, world!",
  "error_description": "Hello, world!",
  "error_message": "Hello, world!"
}
Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error_code": {
      "type": "string",
      "description": "Error code"
    },
    "error": {
      "type": "string",
      "description": "Error"
    },
    "error_description": {
      "type": "string",
      "description": "Error description"
    },
    "error_message": {
      "type": "string",
      "description": "Error message"
    }
  }
}

is it configurable?

jamesmullenbach commented 8 years ago

What did you end up doing to fix this?

alex88 commented 8 years ago

@jamesmullenbach I haven't but I closed the issue since I wanted to clear my list of openend issues.. If you want I can reopen this but I doubt anyone would take care of

zaubara commented 8 years ago

Just stumbled across this issue, making my api description exported via aglio rather useless. :-(

balamuralisrinivasan commented 8 years ago

This works fine in apiary but as per above post fails in aglio. Can this be fixed?

Kyslik commented 6 years ago

Note: this is a hack, and should be documented in your build script or readme of the project

I ended up using sed

sed -i -- 's/"nullified"/null/g' ./index.html

So for:

+ Response 200 (application/json)
    + Attributes (object)
        + status: nullified (string, nullable)

In final html "nullified" is changed to null.

EduardTsoy commented 6 years ago

@alex88, @danielgtaylor I've encountered the same problem - Body json is specified in the source .md-file but for unknown reason it is ignored when rendering. Instead of the Body, only example or default values from Attributes description are used when rendering .md to .html.

Could you please reopen this issue? This seems to be a significant bug.

Thank you!

dav-garcia commented 6 years ago

I'm facing the same problem after noticing my API examples are full of "Hello worlds". Just can't find a reason for such behaviour. Could you please fix it?

Thanks very much!

iproha94 commented 6 years ago

using DRAFTER_EXAMPLES parameter solved this problem: DRAFTER_EXAMPLES=true aglio -i apiary.apib

murbot commented 5 years ago

FYI - I clarified use of the DRAFTER_EXAMPLES=true (must be set in the environment) in this thread:

https://stackoverflow.com/questions/41986351/how-to-override-mson-sample-values/53771235#53771235