Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250706) (a6b17d8f6bd)
core\router\schema\example Class Reference
Inheritance diagram for core\router\schema\example:
core\router\schema\openapi_base

Public Member Functions

 __construct (protected string string $name, protected string|null ?string $summary=null, protected string|null ?string $description=null, protected mixed mixed $value=null, protected string|null ?string $externalvalue=null,... $extra,)
 Create a new example.
 
 get_name ()
 Get the name of this example.
 
 get_openapi_description (specification $api, ?string $path=null,)
 Get the OpenAPI data to include in the OpenAPI specification.
 
 get_openapi_schema (specification $api, ?string $path=null,)
 Get the OpenAPI data to include in the OpenAPI specification.
 
 get_reference (bool $qualify=true,)
 Get the $ref for this class.
 
 get_schema_from_type (param $type)
 Get the schema for a given type.
 

Static Public Member Functions

static escape_reference (string $reference)
 Escape a reference following rules defined at https://swagger.io/docs/specification/using-ref/.
 
static get_reference_for_class (string $classname, bool $qualify=true,)
 Get the $ref a class name.
 
static get_reference_for_example (string $reference)
 Get the qualified $ref for an example.
 
static get_reference_for_header (string $reference)
 Get the qualified $ref for a parameter.
 
static get_reference_for_parameter (string $reference)
 Get the qualified $ref for a parameter.
 
static get_reference_for_request_body (string $reference)
 Get the qualified $ref for a request body.
 
static get_reference_for_response (string $reference)
 Get the qualified $ref for a response.
 
static get_reference_for_schema (string $reference)
 Get the qualified $ref for a schema.
 

Constructor & Destructor Documentation

◆ __construct()

core\router\schema\example::__construct ( protected string string $name,
protected string|null ?string $summary = null,
protected string|null ?string $description = null,
protected mixed mixed $value = null,
protected string|null ?string $externalvalue = null,
... )

Create a new example.

Parameters
string$nameThe name of the example.
string | null$summaryA summary of the example.
string | null$descriptionA long description fo the example. CommonMark syntax may be used.
mixed$valueEmbedded literal example.
string | null$externalvalueA URI that points to the literal example.
mixed...$extra
Exceptions
coding_exceptionif both the value and externalvalue are null
Parameters
$nameThe name of the example
$summaryA summary of the example
$descriptionA long description fo the example. CommonMark syntax may be used
$valueEmbedded literal example.

The value field and externalValue field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary.

Parameters
$externalvalueA URI that points to the literal example.

This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The value field and externalValue field are mutually exclusive. See the rules for resolving Relative References.

Member Function Documentation

◆ escape_reference()

static core\router\schema\openapi_base::escape_reference ( string $reference)
staticinherited

Escape a reference following rules defined at https://swagger.io/docs/specification/using-ref/.

Parameters
string$reference
Return values
string

◆ get_name()

core\router\schema\example::get_name ( )

Get the name of this example.

Return values
string

◆ get_openapi_description()

core\router\schema\example::get_openapi_description ( specification $api,
?string $path = null )

Get the OpenAPI data to include in the OpenAPI specification.

Parameters
specification$api
null | string$path
Return values
null|stdClass

Reimplemented from core\router\schema\openapi_base.

◆ get_openapi_schema()

core\router\schema\openapi_base::get_openapi_schema ( specification $api,
?string $path = null )
finalinherited

Get the OpenAPI data to include in the OpenAPI specification.

Parameters
specification$api
null | string$path
Return values
null|stdClass
Exceptions
coding_exception

◆ get_reference()

core\router\schema\openapi_base::get_reference ( bool $qualify = true)
inherited

Get the $ref for this class.

Parameters
bool$qualifyWhether to qualify the reference with the #/components/ part.
Return values
string

◆ get_reference_for_class()

static core\router\schema\openapi_base::get_reference_for_class ( string $classname,
bool $qualify = true )
staticinherited

Get the $ref a class name.

https://swagger.io/docs/specification/using-ref/

Parameters
string$classnameThe class to get a reference for
bool$qualifyWhether to qualify the reference with the #/components/ part
Return values
stringThe reference
Exceptions
coding_exception

◆ get_reference_for_example()

static core\router\schema\openapi_base::get_reference_for_example ( string $reference)
staticinherited

Get the qualified $ref for an example.

Parameters
string$reference
Return values
string

◆ get_reference_for_header()

static core\router\schema\openapi_base::get_reference_for_header ( string $reference)
staticinherited

Get the qualified $ref for a parameter.

Parameters
string$reference
Return values
string

◆ get_reference_for_parameter()

static core\router\schema\openapi_base::get_reference_for_parameter ( string $reference)
staticinherited

Get the qualified $ref for a parameter.

Parameters
string$reference
Return values
string

◆ get_reference_for_request_body()

static core\router\schema\openapi_base::get_reference_for_request_body ( string $reference)
staticinherited

Get the qualified $ref for a request body.

Parameters
string$reference
Return values
string

◆ get_reference_for_response()

static core\router\schema\openapi_base::get_reference_for_response ( string $reference)
staticinherited

Get the qualified $ref for a response.

Parameters
string$reference
Return values
string

◆ get_reference_for_schema()

static core\router\schema\openapi_base::get_reference_for_schema ( string $reference)
staticinherited

Get the qualified $ref for a schema.

Parameters
string$reference
Return values
string

◆ get_schema_from_type()

core\router\schema\openapi_base::get_schema_from_type ( param $type)
inherited

Get the schema for a given type.

Parameters
param$type
Return values
stdClass

The documentation for this class was generated from the following file: