Example with html description of bodyParam
- [x] I've read the documentation and I can't find details on how to achieve this.
Hello, I'm trying to set an example in a @bodyParam field description where I have put some html code. If I just put the "Example: ..." string it set the example correctly but it also remove all the filed description. Is this even possible? How can I achieve this behaviour.
Here is an example of the field with html code. Where do I have to put the "Example:" string?
* @bodyParam answers.attitude integer required The value must be one of <strong>1</strong>, <strong>2</strong>, <strong>3</strong> or <strong>4</strong> </br>
* <p><strong>Q</strong>: ¿Qué rentabilidad negativa anual puedes soportar sin verte forzado a vender?</p>
* <ul>
* <li><strong>1</strong>: Hasta -3%</li>
* <li><strong>2</strong>: Hasta -7%</li>
* <li><strong>3</strong>: Hasta -14%</li>
* <li><strong>4</strong>: Hasta -20%</li>
* </ul>
Does the HTML work? If the HTML description works, you should be able to put the "Example:" right after it.
It does work without the "Example:". But it all disappear right after I put the "Example:". I've tried it in different ways
* @bodyParam answers.attitude integer required The value must be one of <strong>1</strong>, <strong>2</strong>, <strong>3</strong> or <strong>4</strong> </br>
* <p><strong>Q</strong>: ¿Qué rentabilidad negativa anual puedes soportar sin verte forzado a vender?</p>
* <ul>
* <li><strong>1</strong>: Hasta -3%</li>
* <li><strong>2</strong>: Hasta -7%</li>
* <li><strong>3</strong>: Hasta -14%</li>
* <li><strong>4</strong>: Hasta -20%</li>
* </ul> Example: 1
* @bodyParam answers.attitude integer required The value must be one of <strong>1</strong>, <strong>2</strong>, <strong>3</strong> or <strong>4</strong> </br>
* <p><strong>Q</strong>: ¿Qué rentabilidad negativa anual puedes soportar sin verte forzado a vender?</p>
* <ul>
* <li><strong>1</strong>: Hasta -3%</li>
* <li><strong>2</strong>: Hasta -7%</li>
* <li><strong>3</strong>: Hasta -14%</li>
* <li><strong>4</strong>: Hasta -20%</li>
* </ul>
* Example: 1
But non of them are working, they all remove the whole HTML part.
Hmm... There might be a bug in the regex that matches them.
But I wouldn't advise using HTML in your field descriptions. It's verbose and brittle. Everything in your example can be done with Markdown.
Ok, I've changed it to markdown but I still have the same problem. The example is set correctly but the description disappears.
* @bodyParam answers.attitude integer required The value must be one of **1**, **2**, **3** or **4**
* **Q**: ¿Qué rentabilidad negativa anual puedes soportar sin verte forzado a vender?
* * **1**: Hasta -3%
* * **2**: Hasta -7%
* * **3**: Hasta -14%
* * **4**: Hasta -20%
* Example: 1
Hello, is there any update on this bug?
Currently working on v3. It's on the roadmap.
This should be fixed in v2.7.3. Turned out to be a small issue.😅