Possible to use kind of swagger ui locally with remobjects (without swagger install)?

Hi there,
More and more we have to provide REST Server API functions for our customers. The possiblity to get a swagger output from remobjects servers is kind of great. But is there a way to integrate the swagger dist files to the remobject server? So that one is able to use it (Api documentation / execute functions) with a browser without internet access?
Or is there another way to do it like with OpenStack Api in other languages (c#, phyton…). Of course its not possible to install the whole swagger-ui stuff on each customer server.

Hi,

testcase.zip (3.6 MB)

http://localhost:8099/edit/ - swagger-ui-4.10.3

Hi,

by some reasons, it dislikes text/javascript content type for .js, but works with application/javascript.

register correct content type with:

procedure TServerDataModule.DataModuleCreate(Sender: TObject);
begin
  Server.Active := TRUE;
  RegisterContentTypeForExtension('.js',id_ContentType_application_javascript); //added
end;

Great. Works! Thanks a lot

Hi,

I’ve cleaned topic

One more remobjects swagger output related question: how can we add a description in RemObjects service methods for a description output in swagger?
Like:

Hi,

Have you tried to use [RODocumentation('documentation')] ?

Now yes. Works! Where are these kind of informations available?
Thanks

Hi,

when you create a new codefirst service - at the beginning of file:

{$REGION 'brief info for Code-First Services'}
  (*
  set library name, uid, namespace, documentation:
  uRORTTIServerSupport.RODLLibraryName := 'LibraryName';
  uRORTTIServerSupport.RODLLibraryID := '{2533A58A-49D9-47CC-B77A-FFD791F425BE}';
  uRORTTIServerSupport.RODLLibraryNamespace := 'namespace';
  uRORTTIServerSupport.RODLLibraryDocumentation := 'documentation';

  mandatory identificators for services/methods/event sinks:
  [ROService('name')] - name parameter is optional
  [ROServiceMethod('name')] - name parameter is optional
  [ROEventSink('name')] - name parameter is optional

  (optional) class factory - service attribute, only one should be used
  [ROStandardClassFactory] - used by default
  [ROSingletonClassFactory]
  [ROSynchronizedSingletonClassFactory]
  [ROPooledClassFactory(PoolSize,PoolBehavior,PreInitializePool)] - only 1st param is mandatore
  [ROPerClientClassFactory(TimeoutSeconds)]

  other (optional) attributes:
  [ROAbstract] - Marks the service as abstract. it cannot be called directly (service only)
  [ROServiceRequiresLogin] - Sets the 'RequiresSession' property to true at runtime. (service only)
  [RORole('role')]  - allow role (service&service methods only)
  [RORole('!role')] - deny role, (service&service methods only)
  [ROSkip] - for excluding type at generting RODL for clientside
  [ROCustom('myname','myvalue')] - custom attributes
  [RODocumentation('documentation')] - documentation
  [ROObsolete] - add "obsolete" message into documentation
  [ROObsolete('custom message')] - add specified message into documentation
  [ROEnumSoapName(EntityName,SoapEntityName)] - soap mapping. multiple (enums only)

  serialization mode for properties, method parameters, arrays and service's functions results
  [ROStreamAs(Ansi)]
  [ROStreamAs(UTF8)]

  backward compatibility attributes:
  [ROSerializeAsAnsiString] - alias for [ROStreamAs(Ansi)]
  [ROSerializeAsUTF8String] - alias for [ROStreamAs(UTF8)]
  [ROSerializeResultAsAnsiString] - alias for [ROStreamAs(Ansi)]
  [ROSerializeResultAsUTF8String] - alias for [ROStreamAs(UTF8)]
*)
{$ENDREGION}