"Unknown path swaggerui" when different model that default is used

A Xdata module in an Indy server windows works OK with swagger and default model.
Swagger is enabled by using RegisterSwaggerUIService; RegisterOpenAPIService;
After using attribute Model in the entities and ServiceContracts I am creating the module as it follows:
result:=TXDataServerModule.Create(w3c+'/path',createdbpool,TXDataAureliusModel.get('mymodel'));
After that, entities and ServiceContracts work but the swaggerui path does not work
Am I missing something?

Solved.
I believe that RegisterSwaggerUIService; RegisterOpenAPIService; does not work with different model than Default.

function createmodel:TXDataAureliusModel;
var
Expl:TMappingExplorer;
B:TXDataModelBuilder;
begin
Expl:=TMappingExplorer.Get('mymodel');
result:=TXDataAureliusModel.Create(Expl);
B:=TXDataModelBuilder.Create(result);
try
B.Build;
b.RemoveEntitySet(tnotNeeded); //now remove all not needed aurelius CRUD
B.AddService< ICustomOpenApiService>;
b.AddService< ICustomSwaggerUIService>;
finally
B.Free;
end;

The above TXDataAureliusModel as created by createmodel is used instead of TXDataAureliusModel.get('mymodel') in TXDataServerModule creating

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.

You assumption is correct, indeed. For enabling Swagger in a different model than the default, either use the TXDataServer component or use the solution you provided.

1 Like