outmoded / lout

API documentation generator
Other
276 stars 49 forks source link

Joi .strip() information is not given to lout #110

Closed franciscogouveia closed 9 years ago

franciscogouveia commented 9 years ago

I'm trying to hide stripped out attributes from response schemas, in the lout templates. Unfortunately, I can't find a way to do identify stripped out attributes.

Example of a response schema:

Joi.object({
  'thisShouldBeRemoved': Joi.any().strip(),
  'otherField': Joi.string()
})

Gives the following to lout:

{
    "type": "object",
    "allowedValues": null,
    "disallowedValues": null,
    "target": null,
    "children": [
        {
            "name": "thisShouldBeRemoved",
            "type": "any",
            "allowedValues": null,
            "disallowedValues": null,
            "target": null,
            "flags": {
                "allowUnknown": false,
                "required": false,
                "forbidden": false
            },
            "rules": {}
        },
        {
            "name": "otherField",
            "type": "string",
            "allowedValues": null,
            "disallowedValues": null,
            "target": null,
            "rules": {}
        }
    ],
    "rules": {}
}

What I would expect is, e.g. a flag with stripped: true on the child named thisShouldBeRemoved. Or am I missing something?

Thank you


Using:

Marsup commented 9 years ago

IMHO it should be removed from lout, it's an implementation detail that the end-user will never see.

EDIT: read too fast, that's what you were already suggesting :)

Marsup commented 9 years ago

Actually since the fields are validated before being stripped, I opted for a new icon next to the field. Hope it solves your problem.

franciscogouveia commented 9 years ago

Perfect, thanks!