Linux deployment not showing swagger required elements in JSON

Our code uses /// <swagger name="required" /> tags against variables in classes used by our service and these tags are omitted when the code is compiled for Linux and we pull the swagger from http://<host>:<port>/<server>/openapi/swagger.json but when we build the Win64 version those tags appear.

We're using the TIndySparkleHTTPServer.

Is there any reason why the tags would be missing from Linux but present on Win64? Could you point us in the right direction?

Hi @Andy_Palmer, welcome to TMS Support Center!

Such construction is provided by reading a XML file that is generated by Delphi compiler and contains such information (the swagger tag with the required) attribute.

My first guess is that you are not correctly reading such XML files from Linux (either a wrong file name, or you are not distributing them, or something like).

Hi @wlandgraf

I can see the XML files that the compiler generates in both platforms, and they're identical except for the platform. It's all read in with the same methods, using TXDataModelBuilder.LoadXmlDoc(XDataServer.Model); so I'm not sure how we're doing something different for each platform.

Note that XData will raise no errors if the files are not found. Where are your files located, exactly, and what is the code you are using to load them?

Are you able to run any other demos and/or other projects and that work? Have you tried the XDataSwagger demo and see if it works?

The files for both Linux and Win64 are in .\$(Platform)\$(Config) relative to each project, and all of the XML files generated are identical save for the platform details. Do those XML files need to be hosted on the Linux VM rather than in the paths on the Delphi VM?

Unfortunately, the XDataSwagger demo is VCL only, so I can't test it with Linux.

I've attached a reduced project to my other question, which can be used to test this.

https://support.tmssoftware.com/t/custom-definitions-from-iopenapievents-implementation-not-working-for-windows-64/21729

I've found that issue with this now. As you implied, XData was not finding the XML files, and this is because the PAServer was only deploying the executable file to the Linux VM, not the XML files with it.

Thank you for your support.

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