From sgcOpenAPI Parser 2026.2.0 the Delphi parser supports Command Line Interface.
The sgcOpenAPI Parser includes a command line interface that converts an OpenAPI specification into a Delphi (Pascal) client file. The parser validates and normalizes the specification (OpenAPI 3 JSON + bundled schemas) before generating output.
Usage
General syntax
sgcOpenAPI.exe -i "<input file or url>" -o "<output pas>" [options]
Parameters
All parameters are case-insensitive. Short and long forms are equivalent.
- -i -input : [mandatory] Path to the OpenAPI specification or an URL to download. If the input is YAML or Swagger 1/2 it will be converted automatically to OpenAPI 3 JSON.
- -o -output : [mandatory] Output Pascal file to generate (Delphi client).
- -nc -nclasses : [optional] Do not generate Delphi classes for schemas (only interfaces / client methods).
- -nj -njson : [optional] Do not enable JSON serialization for generated classes.
- -nd -ndoc : [optional] Do not generate documentation comments in the output.
- -m -method : [optional] Method naming strategy for generated methods:
- 0 : Use OperationId (default).
- 1 : Use Summary.
- 2 : Use Endpoint path.
- -a -auth : [optional] Authentication mode to enable in the generated client:
- 0 : None.
- 1 : Basic.
- 2 : Token.
- 3 : OAuth2.
- 4 : JWT.
- -u -url : [optional] Override the base URL detected in the OpenAPI file.
- -l -log : [optional] Show log output while parsing.
- -user : [optional] License user name (only required when the license has not been activated).
- -password : [optional] License password (only required when the license has not been activated).
- -h -help : Show command line help.
Examples
1) Generate Delphi client from a local file
sgcOpenAPI.exe -i "c:\specs\openapi.json" -o "c:\clients\orders.pas"
2) Generate client from URL, disable classes and documentation
sgcOpenAPI.exe -i "https://api.example.com/openapi.json" -o "c:\clients\api.pas" -nc -nd
3) Use Summary as method names and enable OAuth2
sgcOpenAPI.exe -i "c:\specs\openapi.json" -o "c:\clients\auth.pas" -m 1 -a 3
4) Override Base URL and show log output
sgcOpenAPI.exe -i "c:\specs\openapi.json" -o "c:\clients\override.pas" -u "https://api.example.com/v2" -l
Troubleshooting
- If the input specification is not valid or is not a bundled OpenAPI 3 JSON file, the parser will attempt to convert and bundle it automatically before generation.
- When using URLs, the parser downloads the specification before validating and generating the output.
- "Input command not found": add -i with file path or URL.
- "Output command not found": add -o with destination .pas file.
- "File does not exists": verify local path and access rights.
- "The OpenAPI File is not valid...": parser could not convert/bundle the source into valid OpenAPI 3 JSON.
- "Invalid License": activate license or pass -user/-password when applicable.