-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"." in method docs example will break rendering #1286
Comments
Hello there pquerner 👋 Thank you for opening your very first issue in this project. We will try to get back to you as soon as we can.👀 |
I think I tracked it down to not "URLs" but points ".". ie, this fails:
and this doesnt fail
I have also tested this behaviour against the latest version 4.1.1. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days |
I am guessing a faulty regexp somewhere (interpret "." literally?), but I couldnt find any in the library. Probably in some external, but I had no luck there either. |
We mostly rely on the AST that TS provides, there is a similar issue. If you wanna debug it, start around here and see where it goes off the rails |
I believe its this code:
produces
while
produces
An empty string is pushed into the exampleLabels array, while the example without the dot pushes undefined into it > resulting in a "Example <Counter>" output and the other a "<empty string>" output. Maybe something like this can be used for request examples
where or better yet have a proper RequestExample decorator so it doesnt have to parse the doc comments ? Feature request was already seen in #1107 |
Ok this was a tough nut to crack and I don't believe its documented anywhere (but in the code). This works:
This honestly needs to be made simpler, no? :D // Edit
(when its just 🤷 This also works
Idk.. its time for a proper RequestExample :D this is insane //Edit |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days |
I'd like to work on this. Hopefully I dont get stuck, but I am sure WoH will be here to help me out if needed? :) //edit OK I need a little push right from the start. I dont even know where to properly start. So far I only have this decorator which I can import in a test project, but it doesnt actually do anything (of course). I thought I could even watch older git commits of smaller stuff, but even that seems out of reach since they are too old and the projects way shifted away from this "style". I wanted the decorator to behave like that:
Thought of linking the interface into that aswell? Like Example decorator
Which would make the "body" thingy obsolete I reckon. |
Indeed this was caused by a bad hasExampleLabel check. I have opened a PR to fix this with your example as test cases. The hasExampleLabel now will only check if there is an example and only look at the dot in location part but not in the content. |
I have a endpoint which consumes a JSON body with a optional
callback_url
property, which is of type string. If this property is set, we willHTTP POST
to this URL.Setting up examples with
I have also tried the URL string unescaped, or without slashes (except for the protocol).
A string such as
a
will render it just fine, so I suspect something with the URL string itself, although I am not sure which part is responsible (protocol, slash escapes, ...)Sorting
I'm submitting a ...
I confirm that I
Expected Behavior
Example 1
should be displayed / generated without problems.Current Behavior
Example is generated as
while missing the header
Example 1
and the actual example. When changing the selectbox option to any other type, and back to theExample 1
(empty string), this is shown:Using a string for
callback_url
such asa
will output this:Code:
Context (Environment)
Version of the library: 4.1.0
Version of NodeJS: v18.6.0
Swagger yml generated:
This part of the example is empty string:
The text was updated successfully, but these errors were encountered: