Namespace: Consultingwerk.OERA.Swagger
Class 
SwaggerHelper Copy to Clipboard
Parent classes:
Inherits: Progress.Lang.Object

File:SwaggerHelper
Purpose:Delegate Class Providing Common Helper Methods
Author(s):Martyn Kemp / Consultingwerk Ltd.
Created:Tue Sep 19 09:41:04 BST 2017
Notes:Supports the "SwaggerRequests" custom log entry type for
detailed error logging



Top Method Summary
Options Name Purpose
+ CHARACTER AblTypeToCatalogType (character) Converts the given ABL Data Type into a Json Catalog type
+ AddBufferFields (handle, JsonObject, character) Adds the temp-table field to the given JsonObject
+ AddBufferFields (handle, JsonObject, character, logical) Adds the temp-table field to the given JsonObject
+ AddBufferFields (handle, JsonObject, character, logical, IBusinessEntityDescriptor) Adds the temp-table field to the given JsonObject
+ Progress.Json.ObjectModel.JsonObject AddDatasetEnvelope (character, JsonObject) Returns a schema for a dataset with a dataset name , as an object.
# AddDatasetRelation (handle, handle, IBusinessEntityDescriptor, character, JsonObject) Adds buffers from a data-relation to the JSON schema
+ Progress.Json.ObjectModel.JsonArray AddKeyFieldsAsQuery (handle, IBusinessEntityDescriptor, JsonArray) Adds key (index) fields from a buffer as query parameters
+ Progress.Json.ObjectModel.JsonObject EnsureJsonObjectExistsAtPath (JsonObject, character) Makes sure that the path exists : so each of the entries is a property in the input JSON object, and that the type of the property is a JSON object
+ Progress.Json.ObjectModel.JsonObject EnsureJsonObjectExistsAtPath (JsonObject, character[]) Makes sure that the path exists : so each of the entries is a property in the input JSON object, and that the type of the property is a JSON object
+ CHARACTER FindTemplate (character) Locates a template file
+ Progress.Json.ObjectModel.JsonObject GetAblTypePropertySchema (character, Class) Returns the schema for a property with an ABL primitive type
+ Progress.Json.ObjectModel.JsonObject GetAnnotationSchema (character, character) Retrieves Schema Definitions defined with the Class Annotation
+ Progress.Json.ObjectModel.JsonObject GetAnnotationSchema (character, character, character, character, IBusinessEntityDescriptor) Retrieves Schema Definitions defined with the Class Annotation
+ CHARACTER GetApiDocAnnotation (character, character) Retrieves an attribute value from the Business Service's ApiDoc Annotation
+ Progress.Json.ObjectModel.JsonArray GetArrayValue (character) Returns the JSON Array for the given value
+ Progress.Json.ObjectModel.JsonArray GetArrayValue (character[]) Returns the JSON Array for the given value
+ Consultingwerk.OERA.BusinessEntityDescriptor.IBusinessEntityDescriptor GetBusinessEntityDescriptor (character, handle) Generates a Business Entity Descriptor for the given Dataset
+ Progress.Json.ObjectModel.JsonObject GetDatasetSchema (handle, IBusinessEntityDescriptor) Returns the JSON Schema description for the ProDataset
+ Progress.Json.ObjectModel.JsonObject GetDatasetSchema (handle, IBusinessEntityDescriptor, character) Returns the JSON Schema description for the ProDataset
+ CHARACTER GetDatasetSchemaType (character, character, character) Retrieves the datasetSchemaType attribute value from a ParameterSchema annotation on an invokable method for a given dataset
+ CHARACTER GetDescriptionAnnotation (character) Retrieves the Business Entity Description Annotation
+ Progress.Json.ObjectModel.JsonObject GetEnumerableSchema (character) Returns the JSON Schema description for an IEnumerable property
+ Progress.Json.ObjectModel.JsonObject GetEnumProperties (Class, ValueFromEnum) Retrieves the Enum Attributes for the specified Enum Class
+ CHARACTER GetEnumValues (Class, ValueFromEnum) Retrieves the Enum Attributes for the specified Enum Class
+ Progress.Json.ObjectModel.JsonObject GetHeaderDetails () Returns the Swagger Header Details defined in a Template File
+ Progress.Json.ObjectModel.JsonObject GetParameterClassSchema (character) Gets a JSON / Swagger schema for a parameter class.
+ Progress.Json.ObjectModel.JsonObject GetParameterClassSchema (Object) Gets a JSON / Swagger schema for a parameter class.
+ Progress.Json.ObjectModel.JsonObject GetPathResponse (character) Returns the JSON Path Response
# Progress.Json.ObjectModel.JsonObject GetPropertiesItems (Object, JsonObject) Adds the serializable properties from the given JsonSerializable type to the list of properties
+ CHARACTER GetPropertyDataTypes (character, Class) Returns a comma-delimited list of Swagger/JSON data types for properties of an object.
+ Progress.Json.ObjectModel.JsonObject GetRestfulDatasetSchema (character, handle, IBusinessEntityDescriptor) Returns the JSON RESTful Schema description for the ProDataset
+ Consultingwerk.ListNameValuePair GetRestMethodParameterDescriptions (character, character) Returns a list of the method parameter names and their descriptions
+ Consultingwerk.Framework.Collections.CharacterList GetServers (character, character) Returns the list of servers
+ LOGICAL HasAnnotationSchema (character, character) Checks if a schema definition has been defined for the Class Annotation
+ LOGICAL HasAnnotationSchema (character, character, character) Checks if a schema definition has been defined for the Class Annotation
+ LoadTags (table) Returns any tags defined in the configuration, in the swagger.tags item.
+ LogError (character, Error) LogManager Error Logging
+ Progress.Json.ObjectModel.JsonObject SetDescription (character) Returns the JSON Description
+ Progress.Json.ObjectModel.JsonObject SetResponseSchema (character) Returns the JSON Response Schema

Top Constructor Summary
Options Name Purpose
+ SwaggerHelper () Default constructor.


Method Detail
Top

PUBLIC CHARACTER AblTypeToCatalogType (character)

Purpose: Converts the given ABL Data Type into a Json Catalog type
Notes:

Parameters:
pcAblType CHARACTER
The ABL Data Type
Returns CHARACTER
The Json Catalog data type
Top

PUBLIC AddBufferFields (handle, JsonObject, character)

Purpose: Adds the temp-table field to the given JsonObject
Notes:

Parameters:
phBuffer HANDLE
The handle of the temp-table buffer
poJsonObject Progress.Json.ObjectModel.JsonObject
The JsonObject to add the field to
pcFields CHARACTER
The CAN-DO list of fields to add to the JsonObject to
Top

PUBLIC AddBufferFields (handle, JsonObject, character, logical)

Purpose: Adds the temp-table field to the given JsonObject
Notes:
if FALSE the initial values (DEFAULT-STRING) are used/

Parameters:
phBuffer HANDLE
The handle of the temp-table buffer
poJsonObject Progress.Json.ObjectModel.JsonObject
The JsonObject to add the field to
pcFields CHARACTER
The CAN-DO list of fields to add to the JsonObject
plBufferValueAsDefault LOGICAL
If TRUE, then the buffer's field values (BUFFER-VALUE) are used for the default values.
Top

PUBLIC AddBufferFields (handle, JsonObject, character, logical, IBusinessEntityDescriptor)

Purpose: Adds the temp-table field to the given JsonObject
Notes:
if FALSE the initial values (DEFAULT-STRING) are used

Parameters:
phBuffer HANDLE
The handle of the temp-table buffer
poJsonObject Progress.Json.ObjectModel.JsonObject
The JsonObject to add the field to
pcFields CHARACTER
The CAN-DO list of fields to add to the JsonObject
plBufferValueAsDefault LOGICAL
If TRUE, then the buffer's field values (BUFFER-VALUE) are used for the default values.
poBusinessEntityDescriptor Consultingwerk.OERA.BusinessEntityDescriptor.IBusinessEntityDescriptor
An optional business entity descriptor for containing annotations for the buffer
Top

PUBLIC Progress.Json.ObjectModel.JsonObject AddDatasetEnvelope (character, JsonObject)

Purpose: Returns a schema for a dataset with a dataset name , as an object.
Notes:

Parameters:
pcDatasetName CHARACTER
The dataset name. Typically the SERIALIZE-NAME
poDataset Progress.Json.ObjectModel.JsonObject
The dataset Swagger schema - containing the temp-tables
Returns Progress.Json.ObjectModel.JsonObject
The JsonObject representing the named dataset schema
Top

PROTECTED AddDatasetRelation (handle, handle, IBusinessEntityDescriptor, character, JsonObject)

Purpose: Adds buffers from a data-relation to the JSON schema
Notes:

Parameters:
phRelation HANDLE
The data-relation
phDataset HANDLE
The ProDataset to return the schema for
poBusinessEntityDescriptor Consultingwerk.OERA.BusinessEntityDescriptor.IBusinessEntityDescriptor
The Business Entity Descriptor
pcSchemaName CHARACTER
The name of the schema; needed for cases where a dataset name may be reused in an application
poParentJson Progress.Json.ObjectModel.JsonObject
The parent Swagger document
Top

PUBLIC Progress.Json.ObjectModel.JsonArray AddKeyFieldsAsQuery (handle, IBusinessEntityDescriptor, JsonArray)

Purpose: Adds key (index) fields from a buffer as query parameters
Notes: The Business Entity Descriptor
a new JSON array will be returned

Parameters:
phBuffer HANDLE
The handle of the temp-table buffer
poBusinessEntityDescriptor Consultingwerk.OERA.BusinessEntityDescriptor.IBusinessEntityDescriptor
An optional business entity descriptor
poParameters Progress.Json.ObjectModel.JsonArray
A JSON array into which to add the parameters.
Returns Progress.Json.ObjectModel.JsonArray
The updated JSON array. If an invalid reference is passed in,
Top

PUBLIC Progress.Json.ObjectModel.JsonObject EnsureJsonObjectExistsAtPath (JsonObject, character)

Purpose: Makes sure that the path exists : so each of the entries is a property
in the input JSON object, and that the type of the property is a JSON object
Notes: the path only supports / as path-delimiter

Parameters:
poJson Progress.Json.ObjectModel.JsonObject
The JSON object
pcPath CHARACTER
The path (of object properties) that must exist, and contain a JSON object
Returns Progress.Json.ObjectModel.JsonObject
The JSON object at the path location
Top

PUBLIC Progress.Json.ObjectModel.JsonObject EnsureJsonObjectExistsAtPath (JsonObject, character[])

Purpose: Makes sure that the path exists : so each of the entries is a property
in the input JSON object, and that the type of the property is a JSON object
Notes:

Parameters:
poJson Progress.Json.ObjectModel.JsonObject
The JSON object
pcPath CHARACTER
The path - as an array - (of object properties) that must exist, and contain a JSON object
Returns Progress.Json.ObjectModel.JsonObject
The JSON object at the path location
Top

PUBLIC CHARACTER FindTemplate (character)

Purpose: Locates a template file
Notes:

Parameters:
pcFileName CHARACTER
The file name of the template to return
Returns CHARACTER
The absolute file name of the template
Top

PUBLIC Progress.Json.ObjectModel.JsonObject GetAblTypePropertySchema (character, Class)

Purpose: Returns the schema for a property with an ABL primitive type
Notes: If the property does not exist, or is not of an ABL primitive type,
then an empty JSON object is returned.

Parameters:
pcPropertyName CHARACTER
: The name of the property for which to generate schema
poClass Progress.Lang.Class
: The ABL type representation of the class containing the property
Returns Progress.Json.ObjectModel.JsonObject
The JSON object representing the property
Top

PUBLIC Progress.Json.ObjectModel.JsonObject GetAnnotationSchema (character, character)

Purpose: Retrieves Schema Definitions defined with the Class Annotation
Notes: If the @ParameterSchema Annotation is blank, then we pass back a generic JSON Object

Parameters:
pcClassName CHARACTER
pcRequestMethod CHARACTER
Returns Progress.Json.ObjectModel.JsonObject
The JsonObject representing the schema
Top

PUBLIC Progress.Json.ObjectModel.JsonObject GetAnnotationSchema (character, character, character, character, IBusinessEntityDescriptor)

Purpose: Retrieves Schema Definitions defined with the Class Annotation
Notes: If the @ParameterSchema Annotation is blank, then we pass back a generic JSON Object

Parameters:
pcClassName CHARACTER
pcRequestMethod CHARACTER
pcDatasetName CHARACTER
pcDatasetSchemaName CHARACTER
poBusinessEntityDescriptor Consultingwerk.OERA.BusinessEntityDescriptor.IBusinessEntityDescriptor
Returns Progress.Json.ObjectModel.JsonObject
The JsonObject representing the schema
Top

PUBLIC CHARACTER GetApiDocAnnotation (character, character)

Purpose: Retrieves an attribute value from the Business Service's ApiDoc Annotation
Notes: If the ApiDoc Annotation's attribute does not exist, or the annotation does not exist,
an empty value is returned (to signal the caller to use a default value).

Parameters:
pcEntityName CHARACTER
The Business Service Name
pcAttributeName CHARACTER
The attribute name to retrieve
Returns CHARACTER
The ApiDoc Annotation's attribute value
Top

PUBLIC Progress.Json.ObjectModel.JsonArray GetArrayValue (character)

Purpose: Returns the JSON Array for the given value
Notes:

Parameters:
pcValue CHARACTER
The Array Value
Returns Progress.Json.ObjectModel.JsonArray
The JsonArray Values
Top

PUBLIC Progress.Json.ObjectModel.JsonArray GetArrayValue (character[])

Purpose: Returns the JSON Array for the given value
Notes:

Parameters:
pcValue CHARACTER
An array of values to add
Returns Progress.Json.ObjectModel.JsonArray
The JsonArray Values
Top

PUBLIC Consultingwerk.OERA.BusinessEntityDescriptor.IBusinessEntityDescriptor GetBusinessEntityDescriptor (character, handle)

Purpose: Generates a Business Entity Descriptor for the given Dataset
Notes:

Parameters:
pcEntityName CHARACTER
The name of the business entity
phDataset HANDLE
The current Business Entity Dataset
Returns Consultingwerk.OERA.BusinessEntityDescriptor.IBusinessEntityDescriptor
The BusinessEntityDescriptor
Top

PUBLIC Progress.Json.ObjectModel.JsonObject GetDatasetSchema (handle, IBusinessEntityDescriptor)

Purpose: Returns the JSON Schema description for the ProDataset
Notes: Does not include the schema envelope

Parameters:
phDataset HANDLE
The ProDataset to return the schema for
poBusinessEntityDescriptor Consultingwerk.OERA.BusinessEntityDescriptor.IBusinessEntityDescriptor
The Business Entity Descriptor
Returns Progress.Json.ObjectModel.JsonObject
The JsonObject representing the schema
Top

PUBLIC Progress.Json.ObjectModel.JsonObject GetDatasetSchema (handle, IBusinessEntityDescriptor, character)

Purpose: Returns the JSON Schema description for the ProDataset
Notes: Does not include the schema envelope

Parameters:
phDataset HANDLE
The ProDataset to return the schema for
poBusinessEntityDescriptor Consultingwerk.OERA.BusinessEntityDescriptor.IBusinessEntityDescriptor
The Business Entity Descriptor
pcSchemaName CHARACTER
The name of the schema; needed for cases where a dataset name may be reused in an application
Returns Progress.Json.ObjectModel.JsonObject
The JsonObject representing the schema
Top

PUBLIC CHARACTER GetDatasetSchemaType (character, character, character)

Purpose: Retrieves the datasetSchemaType attribute value from a ParameterSchema annotation on
an invokable method for a given dataset
Notes:

Parameters:
pcEntityName CHARACTER
The class name
pcMethodName CHARACTER
The method name
pcDatasetName CHARACTER
The dataset name
Returns CHARACTER
The ParameterSchema's datasetSchemaType attribute value
Top

PUBLIC CHARACTER GetDescriptionAnnotation (character)

Purpose: Retrieves the Business Entity Description Annotation
Notes: If the Description Annotation is blank, then we set the description to the
Business Entity name
The Catch Block is in place so if ObjectAssert:IsValid fails, we still
continue and populate the description and generate a swagger file

Parameters:
pcEntityName CHARACTER
The Business Entity Name
Returns CHARACTER
The Business Entity Description Annotation
Top

PUBLIC Progress.Json.ObjectModel.JsonObject GetEnumerableSchema (character)

Purpose: Returns the JSON Schema description for an IEnumerable property
Notes: Does not include the schema envelope

Parameters:
pcName CHARACTER
The name of the property
Returns Progress.Json.ObjectModel.JsonObject
The JsonObject representing the schema
Top

PUBLIC Progress.Json.ObjectModel.JsonObject GetEnumProperties (Class, ValueFromEnum)

Purpose: Retrieves the Enum Attributes for the specified Enum Class
Notes:

Parameters:
poClass Progress.Lang.Class
the Progress.Lang.Class of the Enum
poValueFrom Consultingwerk.Util.Enum.ValueFromEnum
The ValueFromEnum member that describes if the ValueList items will use the Enum's value (integer) or name as the data value
Returns Progress.Json.ObjectModel.JsonObject
The JSON Object containing the enum Details
Top

PUBLIC CHARACTER GetEnumValues (Class, ValueFromEnum)

Purpose: Retrieves the Enum Attributes for the specified Enum Class
Notes:

Parameters:
poClass Progress.Lang.Class
the Progress.Lang.Class of the Enum
poValueFrom Consultingwerk.Util.Enum.ValueFromEnum
The ValueFromEnum member that describes if the ValueList items will use the Enum's value (integer) or name as the data value
Returns CHARACTER
Character delimited list containing the Enum Values
Top

PUBLIC Progress.Json.ObjectModel.JsonObject GetHeaderDetails ()

Purpose: Returns the Swagger Header Details defined in a Template File
Notes: Details shall be retrieved from the Swaggerfile.json Template file

Returns Progress.Json.ObjectModel.JsonObject
The JSON Object containing the header Details
Top

PUBLIC Progress.Json.ObjectModel.JsonObject GetParameterClassSchema (character)

Purpose: Gets a JSON / Swagger schema for a parameter class.
Notes:

Parameters:
pcParameterClassName CHARACTER
Parameter Class Name
Returns Progress.Json.ObjectModel.JsonObject
The JSON Object parameter properties for the Parameter Class
Top

PUBLIC Progress.Json.ObjectModel.JsonObject GetParameterClassSchema (Object)

Purpose: Gets a JSON / Swagger schema for a parameter class.
Notes:

Parameters:
poParameterClass Progress.Lang.Object
An instance of the parameter Class
Returns Progress.Json.ObjectModel.JsonObject
The JSON Object parameter properties for the Parameter Class
Top

PUBLIC Progress.Json.ObjectModel.JsonObject GetPathResponse (character)

Purpose: Returns the JSON Path Response
Notes:

Parameters:
pcDefinition CHARACTER
Definition Response Name
Returns Progress.Json.ObjectModel.JsonObject
The JsonObject for the Paths Response
Top

PROTECTED Progress.Json.ObjectModel.JsonObject GetPropertiesItems (Object, JsonObject)

Purpose: Adds the serializable properties from the given
JsonSerializable type to the list of properties
Notes:
then the input JSON object is returned.

Parameters:
poParameter Progress.Lang.Object
The parameter object instance
poPropertyItems Progress.Json.ObjectModel.JsonObject
The properties JsonObject
Returns Progress.Json.ObjectModel.JsonObject
The updated JSON object. If the poParameter object is not of type IJsonSerializable,
Top

PUBLIC CHARACTER GetPropertyDataTypes (character, Class)

Purpose: Returns a comma-delimited list of Swagger/JSON data types for
properties of an object.
Notes: The parameter names must be the property names.

Parameters:
pcParameters CHARACTER
The comma-delimited list of parameters
poParameterType Progress.Lang.Class
The parameter class type
Returns CHARACTER
The comma-delimited list of Swagger-compliant data types
Top

PUBLIC Progress.Json.ObjectModel.JsonObject GetRestfulDatasetSchema (character, handle, IBusinessEntityDescriptor)

Purpose: Returns the JSON RESTful Schema description for the ProDataset
Notes: Does not include the schema envelope

Parameters:
pcSchemaName CHARACTER
The Schema Name to attach to Schema Definition
phDataset HANDLE
The ProDataset to return the schema for
poBusinessEntityDescriptor Consultingwerk.OERA.BusinessEntityDescriptor.IBusinessEntityDescriptor
The Business Entity Descriptor
Returns Progress.Json.ObjectModel.JsonObject
The JsonObject representing the schema
Top

PUBLIC Consultingwerk.ListNameValuePair GetRestMethodParameterDescriptions (character, character)

Purpose: Returns a list of the method parameter names and their descriptions
Notes: The @RestMethodParameter annotation is read for this information

Parameters:
pcClassName CHARACTER
The name of the entity
pcMethodName CHARACTER
The method name
Returns Consultingwerk.ListNameValuePair
A list of parameter names and their descriptions for this method. Will always be a valid reference; may be empty
Top

PUBLIC Consultingwerk.Framework.Collections.CharacterList GetServers (character, character)

Purpose: Returns the list of servers
Notes:

Parameters:
pcServiceURI CHARACTER
The default service URI
pcBasePath CHARACTER
The default base path
Returns Consultingwerk.Framework.Collections.CharacterList
The list of servers
Top

PUBLIC LOGICAL HasAnnotationSchema (character, character)

Purpose: Checks if a schema definition has been defined for the Class Annotation
Notes:

Parameters:
pcClassName CHARACTER
The Class Name
pcRequestMethod CHARACTER
The Request Method Name
Returns LOGICAL
Logical value indicating if a schema definition has been defined for the Class Annotation
Top

PUBLIC LOGICAL HasAnnotationSchema (character, character, character)

Purpose: Checks if a schema definition has been defined for the Class Annotation
Notes:

Parameters:
pcClassName CHARACTER
The Class Name
pcRequestMethod CHARACTER
The Request Method Name
pcDatasetName CHARACTER
The name of the dataset schema to query. Can be *|empty|? for all datasets for this method.
Returns LOGICAL
Logical value indicating if a schema definition has been defined for the Class Annotation
Top

PUBLIC LoadTags (table)

Purpose: Returns any tags defined in the configuration, in the swagger.tags item.
Notes:

Parameters:
ttTags TEMP-TABLE ttTags
Temp-table contains the loaded tags
Top

PUBLIC LogError (character, Error)

Purpose: LogManager Error Logging
Notes:

Parameters:
pcOperation CHARACTER
Operation Name
poError Progress.Lang.Error
Error Object
Top

PUBLIC Progress.Json.ObjectModel.JsonObject SetDescription (character)

Purpose: Returns the JSON Description
Notes:

Parameters:
pcDescription CHARACTER
Description Value for the JsonObject
Returns Progress.Json.ObjectModel.JsonObject
The JsonObject for the Description Node
Top

PUBLIC Progress.Json.ObjectModel.JsonObject SetResponseSchema (character)

Purpose: Returns the JSON Response Schema
Notes:

Parameters:
pcDataset CHARACTER
Description Value for the Definitions Dataset Node
Returns Progress.Json.ObjectModel.JsonObject
The JsonObject for the Definitions Dataset Node


Constructor Detail
Top

PUBLIC SwaggerHelper ()

Purpose: Default constructor.
Notes: There's no need to create instances of the helper classes



Temp-Table Detail

Temp-Table ttTags

Defined in:


©2006-2023 Consultingwerk Ltd.         info@consultingwerk.de         http://www.consultingwerk.de       09.11.2024 18:38:48