Add fixture for nested objects
Summary: Adding this fixture in a standalone diff so it is easier to see the change on the next one. Reviewed By: JoshuaGross Differential Revision: D16852439 fbshipit-source-id: 3f167509b78ebb95f31e44fbf40e9551d4a5500b
This commit is contained in:
Родитель
685a25ca2e
Коммит
e9ef560e87
|
@ -794,6 +794,32 @@ const OBJECT_PROPS: SchemaType = {
|
|||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'nestedPropA',
|
||||
optional: false,
|
||||
typeAnnotation: {
|
||||
type: 'ObjectTypeAnnotation',
|
||||
properties: [
|
||||
{
|
||||
name: 'nestedPropB',
|
||||
optional: false,
|
||||
typeAnnotation: {
|
||||
type: 'ObjectTypeAnnotation',
|
||||
properties: [
|
||||
{
|
||||
name: 'nestedPropC',
|
||||
optional: true,
|
||||
typeAnnotation: {
|
||||
type: 'StringTypeAnnotation',
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
|
@ -795,6 +795,40 @@ static inline std::string toString(const ObjectPropsObjectPropObjectPrimitiveReq
|
|||
return \\"[Object ObjectPropsObjectPropObjectPrimitiveRequiredPropStruct]\\";
|
||||
}
|
||||
|
||||
struct ObjectPropsObjectPropNestedObjectPropNestedObjectInObjectPropStruct {
|
||||
std::string stringProp;
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const RawValue &value, ObjectPropsObjectPropNestedObjectPropNestedObjectInObjectPropStruct &result) {
|
||||
auto map = (better::map<std::string, RawValue>)value;
|
||||
|
||||
auto stringProp = map.find(\\"stringProp\\");
|
||||
if (stringProp != map.end()) {
|
||||
fromRawValue(stringProp->second, result.stringProp);
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string toString(const ObjectPropsObjectPropNestedObjectPropNestedObjectInObjectPropStruct &value) {
|
||||
return \\"[Object ObjectPropsObjectPropNestedObjectPropNestedObjectInObjectPropStruct]\\";
|
||||
}
|
||||
|
||||
struct ObjectPropsObjectPropNestedObjectPropStruct {
|
||||
ObjectPropsNestedObjectInObjectPropStruct nestedObjectInObjectProp;
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const RawValue &value, ObjectPropsObjectPropNestedObjectPropStruct &result) {
|
||||
auto map = (better::map<std::string, RawValue>)value;
|
||||
|
||||
auto nestedObjectInObjectProp = map.find(\\"nestedObjectInObjectProp\\");
|
||||
if (nestedObjectInObjectProp != map.end()) {
|
||||
fromRawValue(nestedObjectInObjectProp->second, result.nestedObjectInObjectProp);
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string toString(const ObjectPropsObjectPropNestedObjectPropStruct &value) {
|
||||
return \\"[Object ObjectPropsObjectPropNestedObjectPropStruct]\\";
|
||||
}
|
||||
|
||||
struct ObjectPropsObjectPropStruct {
|
||||
std::string stringProp;
|
||||
bool booleanProp;
|
||||
|
@ -803,6 +837,7 @@ struct ObjectPropsObjectPropStruct {
|
|||
ObjectPropsStringEnumProp stringEnumProp;
|
||||
ObjectPropsObjectArrayPropStruct objectArrayProp;
|
||||
ObjectPropsObjectPrimitiveRequiredPropStruct objectPrimitiveRequiredProp;
|
||||
ObjectPropsNestedObjectPropStruct nestedObjectProp;
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const RawValue &value, ObjectPropsObjectPropStruct &result) {
|
||||
|
@ -836,6 +871,10 @@ static inline void fromRawValue(const RawValue &value, ObjectPropsObjectPropStru
|
|||
if (objectPrimitiveRequiredProp != map.end()) {
|
||||
fromRawValue(objectPrimitiveRequiredProp->second, result.objectPrimitiveRequiredProp);
|
||||
}
|
||||
auto nestedObjectProp = map.find(\\"nestedObjectProp\\");
|
||||
if (nestedObjectProp != map.end()) {
|
||||
fromRawValue(nestedObjectProp->second, result.nestedObjectProp);
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string toString(const ObjectPropsObjectPropStruct &value) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче