-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Redundant "data" field in API spec (collections.yaml) #1321
Comments
@stargazer33 since you're able to spot these issues and you're familiar with the spec, would greatly appreciate it if you could send a PR with the fixes. Will save compared to time passing these on to @rohansh-tty who is the original contributor of the collection. Thanks! |
@knadh - I am focused only on small subset of Subscriber+List+Campaign calls, nothing else. It should be a task of the original contributor to think how to fix ALL such issues (my suggestion - to setup automation) |
One more problem: I want to add list 12 to subscriber 23 (JSON below generated based on the API spec in collections.yml - I am not writing it manually):
and Listmonk response is:
I think, the problem is in collections.yml, line 316 - the "ids" field is NOT an array (please check definition of other fields too!):
UPDATE: the And may be some other places in *.yml have this problem too, pls check... |
And again one more: The Here (and in many other places!) it is an integer: Line 473:
Here it is a number: Line 2940:
|
…nteger types and added description
@knadh @rohansh-tty Can not say about functionality... yet... But, for the future - you have to avoid such huge API changes!!! I wrote two (playground) clients for this API and what I see - this change broke them. Have to rename many methods. |
Hi, I was going through the changes that introduced the API spec. From my (very limited) knowledge in Golang, there's no easy way to auto-generate the spec file without adding documentation through the project (ref https://github.com/swaggo/echo-swagger). Would it make sense to introduce something like this through the codebase so the file is auto-generated. |
Hi @stargazer33. Sorry to hear that. From what I've learnt here, the Swagger collection has a lot of issues. Basically, wrong spec/wrong API definitions. So the APIs shouldn't have worked in the first place. They are getting corrected now. How was it working in your setup?
From what I know @rohansh-tty has created the collection manually. If there's a straight forward way to generate it automatically from the code itself, that'd be the ideal way forward to keep the API + collection in sync. I have never had time to explore this unfortunately. The tool you've shared looks interesting, although it'll have to be run manually every time there's a change. Will check this out. |
Yes, either this way... OR: you can go another way: keep the current *.yml and... validate the HTTP+JSON of the actual requests+responses on the server side against the specification in the *.yml file. Something like this: As far as I understand - these P.S. I'm not a Go programmer, but somehow I (half)understand the code ))) |
OK, this: rohansh-tty@3593fc0 looks good (much better than before), but there still can be errors - I am testing only a few API calls |
Ok, the problem in the #1325 happens because the URL in the collections.yml is wrong. this code works
So it should be |
One more: The
|
Version:
latest, see https://listmonk.app/docs/swagger/collections.yaml
After fixing #1317 still there are problems in the *.yml file.
Now the
data
field added to JSON response (everywhere?). This is great.What is not great - the
data
field still exists in some response objects/structures.It looks like the response should contain the
data
two times, which is not the case!I know about these places:
These two places: it is definetly a bug:
Line 3106 (in collections.yaml):
Line 3168:
These two places: I'm not sure, please compare with real JSON response/test:
Line 2751:
Some additional info
Having collections.yaml is a great help, thanks to the authors!
I'm using it to generate client API in Java (need this API to talk to Listmonk from my program. I'm using/creating subscribers, campaigns and lists, nothing else)
It seems, this API spec -I mean the *.yml file- is not used in development of Listmonk server/client code (otherwise these bugs would be fixed very quickly).
I would suggest to setup some (half)automated check to compare the API described in *.yml with real JSONs used on server/client side.
Without such check - it is a never ending story, there always be bugs
There are tools for this, look here: https://openapi.tools/#description-validators
One of these tools, vacuum written in Go by the way :-)
The text was updated successfully, but these errors were encountered: