Jump to content

mvanrijnen

Members
  • Content Count

    489
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by mvanrijnen

  1. mvanrijnen

    swagger help needed

    I'v created my own swagger (json) to delphi creator. It creates some model classes, and a base api client, all the models from swagger can be placed in one file, or every class in a separate file. Currently only working with Swagger v1 json. I try to put a version online when i get it working with the v3 specs. I (we) have written a base json client, which can do several methods of authentication, on top on that, i created a base SwaggerClient, and on top of that you get the generated base client, with al the base api calls following the swagger defintion. example of calling the SWGParser and DelphiGenerator (its not 100% ready :), the parses should return an swaggermodel, which would be given to the generator for example). If you have a swagger.json (v1) then i could try to generate the files for you. procedure TfrmSWGTest.CreateFromSwaggerButton9Click(Sender: TObject); var parser : TSWGParser; generator : TSWGDelphiGenerator; begin parser := TSWGParser.Create; try parser.Parse('C:\MySources\MyCompany\Applicaties\MyApplication\Source\API\Source\MySwagger_File.json'); generator := TSWGDelphiGenerator.Create; try generator.APIName := 'MyApplicationAPI'; generator.FilePrefix := 'MyCompany.'; generator.TypePrefix := 'MyApplicationAPI'; generator.ModulSubName := 'DTO'; generator.HTTPMethodPrefix := '/monitoring'; generator.ExcludeHTTPMethodName := True; generator.IncludeCodeComments := False; generator.SingleDTOFile := True; generator.Generate(parser, 'C:\MySources\MyCompany\Applicaties\MyApplication\Source\API\Generated'); finally generator.Free; end; finally parser.Free; end; end;
×