#1 2020-09-15 09:12:40

radexpol
Member
From: Poland, Krk
Registered: 2019-11-29
Posts: 116

Swagger

I saw in the forum history that there is a swagger template for API documentation. How to implement that documentation API to the Server in the sample code below?

  Server := TSQLRestServerFullMemory.CreateWithOwnModel([], false, 'api');
  Server.CreateMissingTables;

  with Server.ServiceDefine(TServerMonitor,[IServerMonitor]) do
  begin
    //dont add "result" node to response for example {"result":{"key":"value"}}
    ResultAsJSONObjectWithoutResult := True;
    SetOptions([], []).ByPassAuthentication := true;
  end;

  with Server.ServiceDefine(TInteractions,[IInteractions]) do
  begin
    ResultAsJSONObjectWithoutResult := True;
    //all methods "[]" will be executed in main thread
    SetOptions([], [optExecInMainThread]).ByPassAuthentication := true;
  end;

Offline

#2 2020-09-17 19:01:40

radexpol
Member
From: Poland, Krk
Registered: 2019-11-29
Posts: 116

Re: Swagger

The sample project 27 generates the swagger from template. Can I load the template from exe resources to prevent from storing mustache files on disk?

Offline

Board footer

Powered by FluxBB