There is a problem with swagger generating the client

Hi Team,

Using swagger to generate the client and encountered some problems during use, need help and repair. Thank you

  1. When I used <nexus_url>/service/rest/swagger.json to generate the go client, a validation error occurred, I had to fix the error myself and then generate.

The error is as follows:

  • definitions.ContentSelectorApiUpdateRequest.properties.description.allowEmptyValue in body is a forbidden property
  • definitions.RoutingRuleXO.properties.description.allowEmptyValue in body is a forbidden property
  • definitions.ContentSelectorApiCreateRequest.properties.description.allowEmptyValue in body is a forbidden property
  1. When I use the client to call security-related restful api. For example, role and user will return http status code 202 when sending a put request to update resources, but this status code is not defined in swagger.json, which will cause the client program to report an error

I don’t think we specified all possible response codes in the swagger APIs, but rather the most likely error codes. We have never used any auto-generated swagger clients except for the one that displays the REST APIs in the UI. That is the official Swagger UI and it apparently does not care what responses are sent. If you would like to see improvements to particular APIs you might consider opening a ticket on our JIRA instance under the “Dev - Nexus Repo (NEXUS)” project at https://issues.sonatype.org or if you are a paid customer opening an idea on the ideas portal. Either way will help us prioritize changes in the future.

1 Like