#1 Re: mORMot 2 » TOpenApiParser fails on this OpenApi-Schema... » 2025-08-12 11:22:42

Hallo Daniel smile

deutsch
Danke für deinen Hinweis. Und ja, natürlich hast Du Recht. Mir ist schon klar, dass "Wawi" für "Warenwirtschaft" steht. (Und jetzt auch nochmal für alle Nicht-German-Native-Mitleser erklärt smile )
Mir ging es um einen anderen Punkt, WARUM sollte man einen Quasi-Standard derart verbiegen. Wo ist da der Sinn? Wird vielleicht später eine weitere Securtiy-Schicht drübergestülpt? IDK.
Ich werde das mal direkt beim Hersteller in Erfahrung bringen und dann hier auch was dazu schreiben.

english
Thanks for your comment. And yes, of course you're right. I'm well aware that "Wawi" stands for "warehouse management." (And now also explained for all non-German readers smile )
I was talking about a different point: WHY would you bend a quasi-standard like that? What's the point? Will another security layer be added later? IDK.
I'll find out directly from the manufacturer and then write something about it here.


PS: "beer" -> "bearer" - you made my day smile

#2 Re: mORMot 2 » TOpenApiParser fails on this OpenApi-Schema... » 2025-08-11 15:08:44

Yes Arnaud, you're absolutely right.

That's the standard that 99.99% of API developers probably adhere to smile

Unfortunately, in this case, the bearer isn't called "Bearer" but "Wawi"

In other words, this code here (from "mormot.net.client.pas")

    case Scheme of
      wraBasic:
       ...
      wraBearer:
        SockSendLine(['Authorization: Bearer ', Token]);

It should look like this, but that's nonsense.

    case Scheme of
      wraBasic:
       ...
      wraBearer:
        SockSendLine(['Authorization: Wawi ', Token]);

I have no idea why the name was chosen that way. But I'm sure there's a reason for it...   ...but I just don't know it :-)


greetings

#3 Re: mORMot 2 » TOpenApiParser fails on this OpenApi-Schema... » 2025-08-11 11:08:19

Salut Arnaud!

Tu es mon héros officiel du jour! :-)
you are my officially "hero of the day"! :-)

great! generation runs smile
-------------------

If you don´t mind, I have another issue with this schema:

IDK why, but the "securityScheme" seems to appear nowhere

    "securitySchemes": {
      "Wawi": {
        "type": "apiKey",
        "description": "Fill Wawi Token here",
        "name": "Authorization",
        "in": "header"
      }

It is just a header-field "Authorization" with the value "Wawi <guid-string>" as described in the schema-comment at the beginning.


Would it be a good Idea to define a kind of "default-header" in the Client-Class?
i.e. in case of

  • the needed header isn´t specified that way that the generator could find it

  • the format of the value itself seems to be a bit "uncommon" (string + GUID)

  • to simplify the calls (I don´t have to add this header in each function, though it is needed in every function and is always the same)


Maybe something like this:

procedure TForm1.CreateApiClient;
begin
 FJsonClient := TJsonClient.Create(FBaseUrl); 
 FClient := TJtlClient.Create(FJsonClient) ;
 
 // also because of the format of the value, what is "Wawi " + GUID-String 
 FClient.AddDefaultHeader('Authorization', 'Wawi '+GetApiKey);
end;

What do you think?


greetings

#4 mORMot 2 » TOpenApiParser fails on this OpenApi-Schema... » 2025-08-08 11:52:53

Luwo
Replies: 8

Bonjour Dear Arnaud, dear Community

I try to generate Rest-Classes out of this OpenApi-Json-Schema ("1.1-OnPrem"): OpenAPI description v1.1


1) fetched the OpenApi-Definition

mget https://developer.jtl-software.com/_spec/products/erpapi/@1.1-onprem/openapi.json?download  /o openapi_v1.1.json

2) This is the Code

  ApiParser := TOpenApiParser.Create('JTL');
  try

    ApiParser.Options := [];
    ApiParser.ParseFile('openapi_v1.1.json');
    ApiParser.ExportToDirectory( 'c:\temp' );

  except  
    on E : Exception do writeln('Exception: '+E.Message);
  end;

...but it failes with this exception

 TOpenApiParser.ParseRecordDefinition: JTL.Data.Contracts.Keys.ArtikelKey is integer, not object 

what I already did:

  • Validated this schema and it seems to be correct

  • The former schema ("1.0-OnPrem") runs fine  - OpenAPI description v1.0 (maybe of less references? idk)


I could not figure out what the problem causes. Could sombody help here?


Many Thanks in advance
Greetings Luwo

Board footer

Powered by FluxBB