A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
schema.h
Go to the documentation of this file.
1/*
2 * Copyright 2026 The A11 Authors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef A11_FLOW_SCHEMA_H_
18#define A11_FLOW_SCHEMA_H_
19
20#include <string>
21#include <string_view>
22#include <vector>
23
24#include <nlohmann/json_fwd.hpp>
25
26#include "a11/flow/diagnostic.h"
27#include "a11/flow/plan.h"
28
29namespace a11::flow {
30
52nlohmann::json DtoToJsonSchema(const DtoPlan& dto, const Program& program);
53
62 std::vector<DtoPlan> dtos;
71 std::vector<Diagnostic> diagnostics;
72};
73
80SchemaImport JsonSchemaToDtos(const nlohmann::json& schema,
81 std::string_view name);
82
88std::string DtoToFlow(const DtoPlan& dto);
89
91inline constexpr std::string_view kSchemaFormat = "flow.schema/v1";
92
94inline constexpr std::string_view kFlowTypeKey = "x-a11-type";
95
103inline constexpr std::string_view kFlowOrderKey = "x-a11-order";
104
105} // namespace a11::flow
106
107#endif // A11_FLOW_SCHEMA_H_
std::string name
The name and its colon, which travel together because they always do.
Definition format.cc:49
Definition boundary.cc:32
nlohmann::json DtoToJsonSchema(const DtoPlan &dto, const Program &program)
The JSON Schema a struct describes.
Definition schema.cc:711
SchemaImport JsonSchemaToDtos(const nlohmann::json &schema, std::string_view name)
The shapes schema describes, named name where it does not name itself.
Definition schema.cc:728
constexpr std::string_view kFlowOrderKey
The extension key holding a shape's fields in declaration order.
Definition schema.h:103
constexpr std::string_view kSchemaFormat
The format field of the schema envelope.
Definition schema.h:91
std::string DtoToFlow(const DtoPlan &dto)
One shape as the Flow text that declares it.
Definition schema.cc:747
constexpr std::string_view kFlowTypeKey
The extension key that says which Flow type a string really is.
Definition schema.h:94
One compiled struct: a shape a port may be typed with.
Definition plan.h:80
The shapes a JSON Schema describes, and what would not fit.
Definition schema.h:55
std::vector< DtoPlan > dtos
The shape the schema itself is, followed by every $defs entry it named.
Definition schema.h:62
std::vector< Diagnostic > diagnostics
What did not map, as diagnostics rather than a refusal.
Definition schema.h:71
std::string dto
Which shape schema is asked about; every one of them when empty.
Definition main.cc:78