Skip to content

Swagger json schema conversion to C# files #469

Closed

Description

@sacredMonster

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..

Activity

  1. webron commented on Sep 26, 2015

    @webron
    Member

    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.

  2. sacredMonster commented on Sep 29, 2015

    @sacredMonster
    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

  3. dolmen commented on Oct 7, 2015

    @dolmen

    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!
  4. webron commented on Jul 21, 2016

    @webron
    Member

    Closing for inactivity. Please reopen if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions