Custom definitions from IOpenApiEvents implementation not working for Windows 64

We have implemented our own event to customize the definitions exported to the swagger, which removes the unit name from the definitions. This works well when we deploy to Linux, however the code isn't even called when we build for Win64.

We're deploying the PAServer on Ubuntu 20.04, and can see any changes made to the definitions.

It has been noted that when you start the server on Linux you have to use Active := True, however for Windows 64 you have to use StartListening.

Could you give some guidance with how to fix this issue?

Relates to: Swagger customisation

1 Like

Hard to tell what is going on, the used platform it should not make any difference.
Can you please try to reduce your project to a minimum (or create a new one from scratch) so that we can reproduce the issue at our side?

Hi Wagner,

I'll get a reduced project generated and send it over, and see where we can go from there. It's a rather puzzling issue.

I'm attaching a stripped down version.

The Linux deployment generates a swagger with the correct definitions but no swagger 'required' element, whereas the Win64 version has incorrect definitions but the 'required' elements.

Coll8-Delphi-Proxy.zip (26.9 KB)

This is your original question. The answer is that your project has two servers: TIndySparkleHTTPServer and the SparkleHttpSysDispatcher. You are adding the middleware only to the first one, but not to the second.

The easiest way is that you add the middleware directly in the TXDataServer component, using the middleware editor.

In any case, here is the modified project with the mentioned suggestion.

Coll8.zip (21.8 KB)

I fail to see what does this comment has to do with the original comment at all. And, I cannot see what you mention here. I see "required" flag being included. So please open a new topic and provide the exact project and steps to reproduce the issue, than you.

I have taken your suggestions onboard and applied them to the real code, and it works perfectly with Linux and Win64.

Thank you again for your support.

1 Like

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