By Admin on Wednesday, 02 October 2024
Category: All

OpenAPI Parser Bundle Schemas

​From sgcOpenAPI 2024.9.0 the parser has been improved with the following new features:

- Bundle Specification: if the specification is built with multiple schemas, the parser can bundle into a single specification file.

- Output Parser Parameters: when creating the pascal interface, the parameters used to import the specifications are written in the header of the pascal file.

- A new event has been created for the sgcOpenAPI Client, OnBeforeRequest, which can be used to customize the HTTP request before is sent to the server.

Bundle Specification

When OpenAPI or JSON Schema documents get massive or repetitive, the contents can be split across multiple documents (on the filesystem, URLs, in memory somewhere) and joined together $ref. These split up API descriptions can then be joined back together as one document, with $ref pointing to an internal location instead of an external location. This is called "bundling".

Now the sgcOpenAPI Parser supports bundling openAPI specifications. This is done automatically when importing a file.

Splitted OpenAPI Specification

​Bundled Specification

Output Parser Parameters

 The pascal file created from the openAPI specification now contains the parameters used to import the openAPI file. These parameters are created as comments in the top of the delphi file.

OnBeforeRequest event

​This event is called before the HTTP request is called. Allows to customize the Parameter names, Headers, security... Find below an example how to replace the name of some parameters.

Related Posts