-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIntSchemaRepresentable.swift
More file actions
47 lines (42 loc) · 1.14 KB
/
IntSchemaRepresentable.swift
File metadata and controls
47 lines (42 loc) · 1.14 KB
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
43
44
45
46
47
//
// IntSchemaRepresentable.swift
// feather-openapi
//
// Created by Tibor Bödecs on 2026. 01. 22..
//
import OpenAPIKit30
/// Schema representation for integer values.
public protocol IntSchemaRepresentable:
SchemaRepresentable,
ExampleProperty,
DefaultValueProperty,
AllowedValuesProperty
where
ExamplePropertyType == Int,
DefaultValuePropertyType == Int,
AllowedValuesPropertyType == Int
{
}
extension IntSchemaRepresentable {
/// Builds an integer JSON schema.
/// - Returns: The JSON schema.
public func openAPISchema() -> JSONSchema {
.integer(
format: .unspecified,
required: `required`,
nullable: nullable,
permissions: nil,
deprecated: deprecated,
title: title,
description: description,
discriminator: nil,
externalDocs: nil,
multipleOf: nil,
maximum: nil,
minimum: nil,
allowedValues: allowedValues?.map { .init($0) },
defaultValue: defaultValue.map { .init($0) },
example: example.map { .init($0) }
)
}
}