-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoolSchemaRepresentable.swift
More file actions
42 lines (37 loc) · 993 Bytes
/
BoolSchemaRepresentable.swift
File metadata and controls
42 lines (37 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// BoolSchemaRepresentable.swift
// feather-openapi
//
// Created by Tibor Bödecs on 2026. 01. 22..
//
import OpenAPIKit30
/// Schema representation for boolean values.
public protocol BoolSchemaRepresentable:
SchemaRepresentable,
ExampleProperty,
DefaultValueProperty
where
ExamplePropertyType == Bool,
DefaultValuePropertyType == Bool
{
}
extension BoolSchemaRepresentable {
/// Builds a boolean JSON schema.
/// - Returns: The JSON schema.
public func openAPISchema() -> JSONSchema {
.boolean(
format: .generic,
required: `required`,
nullable: nullable,
permissions: nil,
deprecated: deprecated,
title: title,
description: description,
discriminator: nil,
externalDocs: nil,
allowedValues: nil,
defaultValue: defaultValue.map { .init($0) },
example: example.map { .init($0) }
)
}
}