Package-level declarations

Types

Link copied to clipboard

Used to add readJson and convertToMyMarker functions to the generated interfaces. Makes sure convertDataRowsWithOpenApi is always used in conversions.

Link copied to clipboard
Link copied to clipboard
internal fun interface GetRefMarker

Represents a query to find a Marker with certain name. Produces a MarkerResult.

Link copied to clipboard
internal interface IsObject
Link copied to clipboard

Allows for OpenApi type schemas to be converted to DataSchema interfaces.

Link copied to clipboard

https://swagger.io/docs/specification/data-models/data-types/#numbers

Link copied to clipboard
internal sealed class OpenApiMarker : Marker, IsObject

Represents the type of Markers that we can use for code generation. This includes OpenApiMarker.Enum, OpenApiMarker.Interface (and OpenApiMarker.AdditionalPropertyInterface), OpenApiMarker.TypeAlias, and OpenApiMarker.MarkerAlias. It's a bit more flexible than Marker and ensures the right arguments are given for the right type of Marker.

Link copied to clipboard

https://swagger.io/docs/specification/data-models/data-types/#numbers

Link copied to clipboard

https://swagger.io/docs/specification/data-models/data-types/#string

Link copied to clipboard
internal sealed class OpenApiType(val name: String?) : IsObject

Represents all types supported by OpenApi with functions to create a FieldType from each.

Link copied to clipboard
internal fun interface ProduceAdditionalMarker

Represents a call to produce an additional Marker from inside a schema component. Not all objects or enums are named, so this is used to create and produce a name for them.

Link copied to clipboard
internal fun interface RetrievableMarker

Represents a call to toMarker that can be repeated until it returns a MarkerResult.OpenApiMarker.

Functions

Link copied to clipboard
internal fun generatedEnumFieldOf(fieldName: ValidFieldName, columnName: String): GeneratedField

Helper function to create a GeneratedField for enums.

Link copied to clipboard
internal fun generatedFieldOf(fieldName: ValidFieldName, columnName: String, overrides: Boolean, fieldType: FieldType): GeneratedField

Helper function to create a GeneratedField without GeneratedField.columnSchema.

Link copied to clipboard
Link copied to clipboard
fun isOpenApi(url: URL): Boolean
fun isOpenApi(path: Path): Boolean
Link copied to clipboard

Needs to have any type schemas to convert.

Link copied to clipboard
internal fun produceNewEnum(name: String, topInterfaceName: ValidFieldName, values: List<String>, nullable: Boolean, produceAdditionalMarker: ProduceAdditionalMarker): OpenApiMarker.Enum

Small helper function to produce a new enum Marker.

Link copied to clipboard
fun readOpenApi(uri: String, name: String, auth: List<AuthorizationValue>? = null, options: ParseOptions? = null, extensionProperties: Boolean, generateHelperCompanionObject: Boolean, visibility: MarkerVisibility = MarkerVisibility.IMPLICIT_PUBLIC): Code

Parse and read OpenApi specification to DataSchema interfaces.

Link copied to clipboard
fun readOpenApiAsString(openApiAsString: String, name: String, auth: List<AuthorizationValue>? = null, options: ParseOptions? = null, extensionProperties: Boolean, generateHelperCompanionObject: Boolean, visibility: MarkerVisibility = MarkerVisibility.IMPLICIT_PUBLIC): Code

Parse and read OpenApi specification to DataSchema interfaces.

Link copied to clipboard
internal fun FieldType.refersToNullableMarker(getRefMarker: GetRefMarker, topInterfaceName: ValidFieldName): Boolean

Returns whether this FieldType refers to a Marker that is itself nullable (such as a nullable enum, whose nullability is defined by the type and cannot be removed by making a property required). Returns false for primitives and non-nullable markers.

Link copied to clipboard
Link copied to clipboard
internal fun String.toNullable(): String
Link copied to clipboard
internal fun String.withoutTopInterfaceName(topInterfaceName: ValidFieldName): String
Link copied to clipboard
internal fun String.withTopInterfaceName(topInterfaceName: ValidFieldName): String