Skip to content

Swagger json schema conversion to C# files #469

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

Closed
sacredMonster opened this issue Sep 25, 2015 · 4 comments
Closed

Swagger json schema conversion to C# files #469

sacredMonster opened this issue Sep 25, 2015 · 4 comments

Comments

@sacredMonster
Copy link

Hi,
I want to convert the swagger json schema to c# files and was hoping that some one could direct me to a tool/application that already does this. I have searched on the net but could not find any support to convert schema draft v4 to c# files.
Appreciate any help!
Thanks..

@webron
Copy link
Member

webron commented Sep 26, 2015

It seems like you're confusing two things. There's JSON Schema Draft v4 which has nothing to do with Swagger and there's... Swagger.

if you're looking to convert a Swagger definition to C# code, take a look at either our codegen or Azure's autorest.

@sacredMonster
Copy link
Author

Hey Ron,
So here is what I am trying to achieve:
• Generate a bunch of clr files from the swagger 2.0 json schema (present in swagger-spec)
• Use an existing xml to populate the values required for swagger spec using the above c# files
• Convert these c# files to swagger spec file (.json)
• Use the above spec file in swagger ui to invoke the targetted APIs
I don't have access to the code base of the APIs that I am targeting. All I have is an XML file of the documentation from those APIs. I am using swagger as a tool to invoke these apis, however for that I will need to generate the swagger spec file programmatically from the xml file. Hence, I was thinking of the above steps.
Might be I am missing some potential tool under the swagger project, that can help me achieve this? Could you please provide guidance on this?
Thanks

@dolmen
Copy link

dolmen commented Oct 7, 2015

I think you can do step 1 to 3 differently.
I suggest to:

  • use your existing XML file to create a Swagger spec in JSON. You are on your own for this task as only you knows the XML input. But this should be quite easy. You don't need specifically C# for this: any langage that can read XML and output JSON would fit.
  • (your step 4) Use the spec file in swagger-ui (or with swagger-codegen or any other tool that can read swagger specs) to build a client to the targetted APIs
  • profit!

@webron
Copy link
Member

webron commented Jul 21, 2016

Closing for inactivity. Please reopen if needed.

@webron webron closed this as completed Jul 21, 2016
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

No branches or pull requests

3 participants