Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250706) (a6b17d8f6bd)
core\router\schema\openapi_base Class Reference
Inheritance diagram for core\router\schema\openapi_base:
core\router\schema\example core\router\schema\objects\type_base core\router\schema\parameter core\router\schema\request_body core\router\schema\response\content\media_type core\router\schema\response\content\payload_response_type core\router\schema\response\response core\router\schema\objects\array_of_things core\router\schema\objects\scalar_type core\router\schema\objects\schema_object core\router\schema\objects\stacktrace core\router\schema\parameters\header_object core\router\schema\parameters\path_parameter core\router\schema\parameters\query_parameter core\router\schema\response\content\json_media_type core\router\response\empty_response core\router\response\exception_response core_user\route\responses\user_preferences_response

Public Member Functions

 __construct (mixed ... $extra,)
 Base constructor which does nothing.
 
 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\openapi_base::__construct ( mixed ... $extra)

Base constructor which does nothing.

We keep an $extra parameter here for future-proofing. This allows named parameters to be used and allows contrib plugins to make use of parameters in newer versions even if they don't exist in older versions.

Parameters
mixed...$extra Extra arguments to allow for future versions of Moodle to add options without breaking plugins

Member Function Documentation

◆ escape_reference()

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

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

Parameters
string$reference
Return values
string

◆ get_openapi_description()

◆ get_openapi_schema()

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

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)

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 )
static

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)
static

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)
static

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)
static

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)
static

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)
static

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)
static

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)

Get the schema for a given type.

Parameters
param$type
Return values
stdClass

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