Jellyfin Qt
QML Library for interacting with the Jellyfin multimedia server
Loading...
Searching...
No Matches
openapigenerator.d File Reference

Classes

class  CLIArgumentException
 
class  MetaTypeInfo
 
class  Endpoint
 
class  RequestParameter
 

Enumerations

enum  CasePolicy {
  KEEP , PASCAL , CAMEL , SNAKE ,
  SCREAMING_SNAKE , LOWER , UPPER
}
 
enum  ParameterLocation {
  PATH , QUERY , COOKIE , HEADER ,
  BODY
}
 

Functions

int main (string[] args)
 
void realMain (string[] args)
 
void writeCMakeFile (string[] headerFiles, string[] implementationFiles)
 
void writeRequestTypesFile R (File headerFile, File implementationFile, R endpoints) if(is(ElementType!R
 
void generateFileForEndpoints (ref const Node[] endpointNodes, ref const Node allSchemas, ref scope File headerFile, ref scope File implementationFile, ref scope Appender!(Endpoint[]) endpoints, ref const string categoryName)
 
void generateFileForSchema (ref const string name, ref const Node scheme, Node allSchemas, ref scope File headerFile, ref scope File implementationFile)
 
MetaTypeInfo getType (ref const string name, const ref Node node, const ref Node allSchemas)
 
MetaTypeInfo[] collectTypeInfo (const ref Node properties, const ref Node allSchemas)
 
void writeObjectHeader (File output, string name, MetaTypeInfo[] properties, string[] userImports)
 
void writeObjectImplementation (File output, string name, MetaTypeInfo[] properties)
 
void writeEnumHeader (File output, string name, string[] values, string doc="")
 
void writeEnumImplementation (File output, string name, string[] values)
 
void writeHeaderPreamble (File output, immutable string[] fileNamespace, string className, string[] imports=[], string[] userImports=[])
 
void writeHeaderPostamble (File output, immutable string[] fileNamespace, string className)
 
void writeImplementationPreamble (File output, immutable string[] fileNamespace, string folder, string className, string[] imports=[])
 
void writeImplementationPostamble (File output, immutable string[] fileNamespace, string className)
 
string applyCasePolicy (string source, CasePolicy input, CasePolicy output)
 
string guardName (immutable string[] namespace, string className)
 

Variables

dub. sdl
 
string CMAKE_INCLUDE_FILE = "GeneratedSources.cmake"
 
string CMAKE_VAR_PREFIX = "openapi"
 
string INCLUDE_PREFIX = "JellyfinQt"
 
string SRC_PREFIX = ""
 
string MODEL_FOLDER = "dto"
 
string SUPPORT_FOLDER = "support"
 
string LOADER_FOLDER = "loader"
 
string HTTP_LOADER_FOLDER = buildPath("loader", "http")
 
string[string] compatAliases
 
string[string] memberAliases
 
CasePolicy OPENAPI_CASING = CasePolicy.PASCAL
 
CasePolicy CPP_FILENAME_CASING = CasePolicy.LOWER
 
CasePolicy CPP_CLASS_CASING = CasePolicy.PASCAL
 
CasePolicy CPP_CLASS_MEMBER_CASING = CasePolicy.CAMEL
 
string CPP_CLASS_MEMBER_PREFIX = "m_"
 
CasePolicy CPP_CLASS_METHOD_CASING = CasePolicy.CAMEL
 
bool GENERATE_PROPERTIES = true
 
string outputDirectory = "generated"
 
string USAGE = "USAGE: %s <openapi scheme>"
 
 unittest
 

Enumeration Type Documentation

◆ CasePolicy

enum CasePolicy
Enumerator
KEEP 
PASCAL 
CAMEL 
SNAKE 
SCREAMING_SNAKE 
LOWER 
UPPER 

◆ ParameterLocation

Enumerator
PATH 
QUERY 
COOKIE 
HEADER 
BODY 

Function Documentation

◆ applyCasePolicy()

string applyCasePolicy ( string source,
CasePolicy input,
CasePolicy output )

Transforsm the given string from the input casing system to the ouptut casing system.

Params: source = The string to transform

◆ collectTypeInfo()

MetaTypeInfo[] collectTypeInfo ( const ref Node properties,
const ref Node allSchemas )

Given a list of JSON schemes, this will generate a list of MetaTypeInfo[]

◆ generateFileForEndpoints()

void generateFileForEndpoints ( ref const Node[] endpointNodes,
ref const Node allSchemas,
ref scope File headerFile,
ref scope File implementationFile,
ref scope Appender!(Endpoint[]) endpoints,
ref const string categoryName )

Generates files for endpoints in a category Params: endpointNode = YAML node representing the endpoint. allSchemas = YAML node containing the schemas that values in the endpointNOde could reference. headerFile = File to write the header (.h) file to implementationFile = File to write the implementation (.cpp) file to. endpoints = Appender to add any requestParameters encountered to. categoryName = name of the category

◆ generateFileForSchema()

void generateFileForSchema ( ref const string name,
ref const Node scheme,
Node allSchemas,
ref scope File headerFile,
ref scope File implementationFile )

Generates a file containing a class generated based on the given JSON Schema.

◆ getType()

MetaTypeInfo getType ( ref const string name,
const ref Node node,
const ref Node allSchemas )

Create a MetaTypeInfo object based on a JSON schema

In the future, this implementation should use some form of configuration file which contains data about the built-in types, since hard-coding doesn't seem like a good idea.

Params: name = The name of this object node = The node containing the JSON Schema of this object allSchemas = The node containing the a map of names to JSON Schemas, which the node parameter could refrence.

◆ guardName()

string guardName ( immutable string[] namespace,
string className )

Generates a guard name based on a namespace and class name.

Params: namespace = Array of namespaces this class is in. className = The name of this class (or enum or whatever).

◆ main()

int main ( string[] args)

◆ R()

void writeRequestTypesFile R ( File headerFile,
File implementationFile,
R endpoints )

Writes the file with all the types that are just used for making requests to the API endpoint

Params: headerFile = The file to write the header to implementationFile = The file to write the implememntation to endpoints = A list of endpoints to extract request type information from.

◆ realMain()

void realMain ( string[] args)

◆ writeCMakeFile()

void writeCMakeFile ( string[] headerFiles,
string[] implementationFiles )

Writes a CMake file that includes the specified files.

◆ writeEnumHeader()

void writeEnumHeader ( File output,
string name,
string[] values,
string doc = "" )

◆ writeEnumImplementation()

void writeEnumImplementation ( File output,
string name,
string[] values )

◆ writeHeaderPostamble()

void writeHeaderPostamble ( File output,
immutable string[] fileNamespace,
string className )

◆ writeHeaderPreamble()

void writeHeaderPreamble ( File output,
immutable string[] fileNamespace,
string className,
string[] imports = [],
string[] userImports = [] )

◆ writeImplementationPostamble()

void writeImplementationPostamble ( File output,
immutable string[] fileNamespace,
string className )

◆ writeImplementationPreamble()

void writeImplementationPreamble ( File output,
immutable string[] fileNamespace,
string folder,
string className,
string[] imports = [] )

◆ writeObjectHeader()

void writeObjectHeader ( File output,
string name,
MetaTypeInfo[] properties,
string[] userImports )

◆ writeObjectImplementation()

void writeObjectImplementation ( File output,
string name,
MetaTypeInfo[] properties )

Variable Documentation

◆ CMAKE_INCLUDE_FILE

string CMAKE_INCLUDE_FILE = "GeneratedSources.cmake"

◆ CMAKE_VAR_PREFIX

string CMAKE_VAR_PREFIX = "openapi"

◆ compatAliases

string [string] compatAliases

◆ CPP_CLASS_CASING

CasePolicy CPP_CLASS_CASING = CasePolicy.PASCAL

◆ CPP_CLASS_MEMBER_CASING

CasePolicy CPP_CLASS_MEMBER_CASING = CasePolicy.CAMEL

◆ CPP_CLASS_MEMBER_PREFIX

string CPP_CLASS_MEMBER_PREFIX = "m_"

◆ CPP_CLASS_METHOD_CASING

CasePolicy CPP_CLASS_METHOD_CASING = CasePolicy.CAMEL

◆ CPP_FILENAME_CASING

CasePolicy CPP_FILENAME_CASING = CasePolicy.LOWER

◆ GENERATE_PROPERTIES

bool GENERATE_PROPERTIES = true

◆ HTTP_LOADER_FOLDER

string HTTP_LOADER_FOLDER = buildPath("loader", "http")

◆ INCLUDE_PREFIX

string INCLUDE_PREFIX = "JellyfinQt"

◆ LOADER_FOLDER

string LOADER_FOLDER = "loader"

◆ memberAliases

string [string] memberAliases

◆ MODEL_FOLDER

string MODEL_FOLDER = "dto"

◆ OPENAPI_CASING

CasePolicy OPENAPI_CASING = CasePolicy.PASCAL

◆ outputDirectory

string outputDirectory = "generated"

◆ sdl

dub. sdl

◆ SRC_PREFIX

string SRC_PREFIX = ""

◆ SUPPORT_FOLDER

string SUPPORT_FOLDER = "support"

◆ unittest

unittest
Initial value:
{
assert("fooBar".applyCasePolicy(CasePolicy.CAMEL, CasePolicy.SNAKE) == "foo_bar")
CasePolicy
Definition openapigenerator.d:142
string applyCasePolicy(string source, CasePolicy input, CasePolicy output)
Definition openapigenerator.d:957

◆ USAGE

string USAGE = "USAGE: %s <openapi scheme>"