21 #ifndef COMMON_WEB_SCHEMAPARSECONTEXT_H_ 22 #define COMMON_WEB_SCHEMAPARSECONTEXT_H_ 32 #include "common/web/PointerTracker.h" 33 #include "common/web/SchemaErrorLogger.h" 34 #include "common/web/SchemaKeywords.h" 37 #include "ola/web/OptionalItem.h" 42 class ArrayOfSchemaContext;
43 class ArrayOfStringsContext;
44 class DefinitionsParseContext;
45 class DependencyParseContext;
46 class JsonValueContext;
47 class PropertiesParseContext;
48 class SchemaParseContext;
86 m_keyword.Set(keyword);
93 std::string TakeKeyword() {
94 std::string keyword = m_keyword.Value();
102 const std::string& Keyword()
const {
return m_keyword.Value(); }
154 m_schema_defs(definitions) {
162 std::auto_ptr<SchemaParseContext> m_current_schema;
178 : m_schema_defs(definitions),
222 std::auto_ptr<JsonNumber> m_maximum;
223 std::auto_ptr<JsonNumber> m_minimum;
224 std::auto_ptr<JsonNumber> m_multiple_of;
235 std::auto_ptr<SchemaParseContext> m_additional_items_context;
238 std::auto_ptr<SchemaParseContext> m_items_single_context;
239 std::auto_ptr<ArrayOfSchemaContext> m_items_context_array;
248 std::auto_ptr<ArrayOfStringsContext> m_required_items;
249 std::auto_ptr<DependencyParseContext> m_dependency_context;
253 std::auto_ptr<class ArrayOfJsonValuesContext> m_enum_context;
254 std::auto_ptr<class ArrayOfSchemaContext> m_allof_context;
255 std::auto_ptr<class ArrayOfSchemaContext> m_anyof_context;
256 std::auto_ptr<class ArrayOfSchemaContext> m_oneof_context;
257 std::auto_ptr<class SchemaParseContext> m_not_context;
262 std::auto_ptr<const JsonValue> m_default_value;
263 std::auto_ptr<JsonValueContext> m_default_value_context;
270 std::auto_ptr<DefinitionsParseContext> m_definitions_context;
271 std::auto_ptr<PropertiesParseContext> m_properties_context;
273 std::auto_ptr<SchemaParseContext> m_additional_properties_context;
277 template <
typename T>
311 m_schema_defs(definitions) {
321 typedef std::map<std::string, SchemaParseContext*> SchemaMap;
324 SchemaMap m_property_contexts;
336 : m_schema_defs(definitions) {
353 typedef std::vector<SchemaParseContext*> ItemSchemas;
356 ItemSchemas m_item_schemas;
369 typedef std::set<std::string> StringSet;
376 void GetStringSet(StringSet *stringd);
445 bool Empty()
const {
return m_enums.empty(); }
448 std::vector<const JsonValue*> m_enums;
449 std::auto_ptr<JsonValueContext> m_value_context;
468 : m_schema_defs(definitions) {}
479 typedef std::set<std::string> StringSet;
480 typedef std::map<std::string, ValidatorInterface*> SchemaDependencies;
481 typedef std::map<std::string, StringSet> PropertyDependencies;
485 std::auto_ptr<ArrayOfStringsContext> m_property_context;
486 std::auto_ptr<SchemaParseContext> m_schema_context;
488 PropertyDependencies m_property_dependencies;
489 SchemaDependencies m_schema_dependencies;
495 #endif // COMMON_WEB_SCHEMAPARSECONTEXT_H_ Definition: SchemaParseContext.h:170
The base class for JSON values.
Definition: Json.h:119
A JsonParserInterface implementation that builds a parse tree.
Parse the array of objects in an 'items' property.
Definition: SchemaParseContext.h:333
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Creates dummy copy constructor and assignment operator declarations.
Definition: Macro.h:44
The context for schema definitions.
Definition: SchemaParseContext.h:143
Definition: SchemaParseContext.h:307
SchemaParseContext(SchemaDefinitions *definitions)
Create a new SchemaParseContext.
Definition: SchemaParseContext.h:177
The base class for Json BaseValidators. All Visit methods return false.
Definition: JsonSchema.h:121
A SchemaParseContext that reports errors for all types.
Definition: SchemaParseContext.h:114
Definition: SchemaKeywords.h:33
JsonType
The type of JSON data element.
Definition: JsonTypes.h:44
A SchemaParseContext that keeps track of the last keyword / property seen.
Definition: SchemaParseContext.h:78
Definition: JsonSchema.h:946
A JsonParserInterface implementation that builds a tree of JsonValues.
Definition: JsonParser.h:57
SchemaKeyword
The list of valid JSon Schema keywords.
Definition: SchemaKeywords.h:32
std::vector< ValidatorInterface * > ValidatorList
a list of Validators.
Definition: JsonSchema.h:61
The context for an array of JsonValues.
Definition: SchemaParseContext.h:424
Definition: JsonTypes.h:52
The context for a default value.
Definition: SchemaParseContext.h:393
The validator for Json integers.
Definition: JsonSchema.h:473
The interface Json Schema Validators.
Definition: JsonSchema.h:56
The interface all SchemaParseContext classes inherit from.
Definition: SchemaParseContext.h:53
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
A Json Schema, see www.json-schema.org.
The context for a dependency object.
Definition: SchemaParseContext.h:465
DefinitionsParseContext(SchemaDefinitions *definitions)
Create a new DefinitionsParseContext.
Definition: SchemaParseContext.h:152
The validator for JsonObject.
Definition: JsonSchema.h:526
The SchemaErrorLogger captures errors while parsing the schema.
Definition: SchemaErrorLogger.h:41
void ObjectKey(SchemaErrorLogger *, const std::string &keyword)
Called when we encounter a property.
Definition: SchemaParseContext.h:85
The context for an array of strings.
Definition: SchemaParseContext.h:367