Sourcemeta Core 0.0.0
Loading...
Searching...
No Matches
openapi_types.h
1#ifndef SOURCEMETA_CORE_OPENAPI_TYPES_H_
2#define SOURCEMETA_CORE_OPENAPI_TYPES_H_
3
4#ifndef SOURCEMETA_CORE_OPENAPI_EXPORT
5#include <sourcemeta/core/openapi_export.h>
6#endif
7
8#include <sourcemeta/core/json.h>
9#include <sourcemeta/core/memory.h>
10
11#include <cstdint> // std::uint8_t
12#include <functional> // std::function
13#include <string_view> // std::string_view
14
15namespace sourcemeta::core {
16
23enum class OpenAPIObjectKind : std::uint8_t {
26 Document,
27 // The eleven a reference may expect to find, the last of them only from 3.2
28 // onwards, which is where a `content` map and the Components Object both
29 // learn to hold a Reference Object in place of a Media Type Object
31 PathItem,
33 Parameter,
35 RequestBody,
37 Response,
39 Example,
41 Header,
43 Link,
46 Callbacks,
48 SecurityScheme,
50 MediaType,
51 // The rest are never referenced, but every Object gets a location
53 Info,
55 Contact,
57 License,
59 Server,
62 ServerVariable,
64 Components,
66 Paths,
68 Operation,
71 ExternalDocumentation,
74 Encoding,
76 Responses,
78 Tag,
83 Schema,
85 OAuthFlows,
87 OAuthFlow,
89 SecurityRequirement
90};
91
97enum class OpenAPIOperationKind : std::uint8_t {
99 Path,
101 Webhook,
103 Callback
104};
105
118SOURCEMETA_CORE_OPENAPI_EXPORT
119auto openapi_kind_name(const OpenAPIObjectKind kind) noexcept
121
133SOURCEMETA_CORE_OPENAPI_EXPORT
134auto openapi_operation_kind_name(const OpenAPIOperationKind kind) noexcept
136
141
167using OpenAPIResolver = std::function<OpenAPIResolverResult(std::string_view)>;
168
169} // namespace sourcemeta::core
170
171#endif
std::basic_string_view< Char, CharTraits > StringView
The string view type used by the JSON document.
Definition json_value.h:54
@ Reference
The JSON Schema keyword is a reference.
Definition jsonschema_types.h:110
@ Info
General informational messages.
Definition mcp_logging.h:30
Definition memory_owned_or_reference.h:48
OwnedOrReference< JSON > OpenAPIResolverResult
Definition openapi_types.h:140
SOURCEMETA_CORE_OPENAPI_EXPORT auto openapi_kind_name(const OpenAPIObjectKind kind) noexcept -> JSON::StringView
std::function< OpenAPIResolverResult(std::string_view)> OpenAPIResolver
Definition openapi_types.h:167
SOURCEMETA_CORE_OPENAPI_EXPORT auto openapi_operation_kind_name(const OpenAPIOperationKind kind) noexcept -> JSON::StringView