GenerateModule - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Connectivity : OpenApi : GenerateModule

OpenAPI

  

GenerateModule

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

GenerateModule( spec, modulename, opts )

Parameters

spec

-

OpenAPI specification, either a string interpreted as a filename or a nested table or record structure as per the output of JSON:-ParseString or YAML:-ParseString

modulename

-

(optional) string; name that will be used for the generated module and the name of the file to which it will be saved. If spec is a string, the default value is FileTools:-Basename of spec. If spec is not a string, this parameter is not optional

opts

-

(optional) one or more options, as described below

Options

• 

overridehost = truefalse or string

  

if true then all generated strings will require a host for their first argument, instead of using the host in the OpenAPI spec. If a string, then that value will be used instead of the host in the spec.

• 

overrideschema = string

  

if given, its value will be used as the only schema overriding the value of schemes in the OpenAPI spec.

• 

omitpathprefix = string

  

if given, its value will be removed from any auto-generated procedure names.  Useful if the RESTful API has a path prefix and many of the path operations lack an "operationId".

• 

output = string

  

if given, it will be used for the name of the output using the path included

• 

overwrite = truefalse

  

if given the default destination file will be overwritten otherwise, a hyphen and a number will be appended to the file's base name

Description

• 

Given an OpenAPI specification for a RESTful API or other HTTP API, this routine creates a Maple package that interfaces with that API using the URL package. The package is generated and then saved to a file and the string of the name of the file returned.

• 

If possible the file will be saved in the current working directory (currentdir), otherwise it will be saved in the temporary directory returned by FileTools:-TemporaryDirectory.

• 

It defaults to the name modulename.mpl possibly with a hyphen and digits appended to avoid overwriting an existing file.  The default can be changed using the options output and overwrite.

• 

The generated module may then be read into Maple and used as any Maple package.

Examples

filenamecatkerneloptsdatadir,kerneloptsdirsep,example,kerneloptsdirsep,PlaceHolder.yaml

filename/maple/cbat/active/234548/data/example/PlaceHolder.yaml

(1)

outputOpenAPI:-GenerateModulefilename

readoutput

exportsPlaceHolder

PlaceHolder:-getPost1,'nopopup'

Compatibility

• 

The OpenAPI:-GenerateModule command was introduced in Maple 2023.

• 

For more information on Maple 2023 changes, see Updates in Maple 2023.

See Also

HTTP

OpenAPI

URL