Skip to content
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

515 swagger missing #518

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

robot-ranger
Copy link
Contributor

Ok...so...

swagger-codegen appears to only consider the first element listed in "content" (see #515 (comment)).

I am making some concessions to get functional auto-generated swagger clients and also maintain as much existing functionality as possible. This is what I have come up with.

this new PR produces the following on each path listed in swagger:

"responses": {
  "200": {
    "description": "OK",
    "content": {
      "text/plain": {
        "schema": {
	  "type": "object"
        }
      }
    }
  }
}

with the above, the python version of the swagger client template-generates response_type='object' for each end point method. I have not tested other languages.

Without any special headers added, this results in the generated python client returning a byte string of the xml response doc.
With "Accept":"application/json" added to the headers, the generated python client smoothly returns a python dict.

IMO, I think this is the best approach for now. AFAIK this is the most minimal response definition and it gets us going with rapidly generated swagger clients.
In the future, we could consider adding schemas for at least the rest-specific portions of mtconnect such as MTConnectDevices/MTConnectStreams/MTConnectErrors and Header schemas.

I have tested:

  • to verify the output of swagger.json shows the above for each endpoint
  • swagger-codegen with a python generated client:
    • no added headers > returns byte string xml
    • "Accept":"application/xml" in headers > return byte string xml
    • "Accept":"application/json" in headers > returns python dict 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants