I encountered errors generating a c# client from the current version of sync-gateway-public.yaml using both AutoRest and NSwagStudio. When I validated the yaml content with https://editor.swagger.io, I can see that several errors were reported (as attached below). After manually fixing those errors on my own copy of the yaml, I was able to at least generate client codes for my project using NSwagStudio. (AutoRest still failed with an error which I didn’t go deeper to find out a solution)
Even though I was able to get past those errors for my purpose, I thought I should report this problem so that the Couchbase team can address them accordingly.
Details about the problem:
- Download the yaml from:
- Use AutoRest to generate a client (c# in this case):
autorest --csharp --output-folder=.\sgclient --input-file=sync-gateway-public.yaml --namespace=myproject --add-credentials
- With NSwagStudio, I could generate output but all the operations are named like this: AnonymousXXAsync.
Some errors reported by https://editor.swagger.io and what I did to my own copy of yaml to get rid of the errors:
- Changed parameters.since.type from object to string
- Fixed several misspelled ‘description’ properties to ‘description’
- Added meaningful, unique operationId to all operations
- Removed some unsupported properties ‘name’
- Added the missing ‘items’ field at additionalProperties.properties.missing
I also found out that the optional property ‘deleted’ is missing from the ChangesFeedRow definition. I think I need to use that to determine the type of a change.
I hope this helps anyone encountering the same issue.