-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Schema "AnyOf" generated as "anything" #17
Comments
Hey @remigailard80, will have a look at that, too! I don't think we have |
After some first testing,
Could you post a slightly bigger excerpt of the
And those |
I think I found the problem,
was the problem. If I delete that element from the
|
using |
That's really interesting. Because it hints at the problem, I think! Because I don't know how those inline About |
I use
because of this schema's circular ref, I added this is my schema generator for
that's the reason why there remains
right. |
Could you keep those Maybe it would just work, if you'd have those inline Alternatively you could replace those remaining Edit: I think if it really is recursive, and needs to be displayed as such, it could get challenging! |
Uploaded snippet is part of my schema(too long), so i cut them manually, which caused problem.
is this meaning If I understood correctly, that cause some issue on storybook like, the As you suggested, I think �I should use |
You could give it a try, yeah! Let me know if it works! And maybe the following snippet could help you: const addExplicitAnyOfs = (schemaJson: JSONSchema7, schemaAnyOfs: JSONSchema7[]) => {
traverse(schemaJson, {
cb: (schema, pointer, rootSchema) => {
if (schema.items && schema.items.anyOf) {
const componentPath = rootSchema.$id.split('/');
const componentType = path.basename(rootSchema.$id).split('.')[0];
const componentName = uppercamelcase(componentType);
schema.items.anyOf = schema.items.anyOf.map((anyOf: JSONSchema7) => {
if (anyOf.$ref)
return anyOf;
const schemaName = `http://frontend.ruhmesmeile.com/${componentPath[3]}/${componentPath[4]}/${componentType}/${pointer.split('/').pop()}-${anyOf.title.replace(componentName, '').toLowerCase()}.interface.json`;
schemaAnyOfs.push({
$id: schemaName,
$schema: "http://json-schema.org/draft-07/schema#",
...anyOf,
definitions: schemaJson.definitions
});
return { $ref: schemaName };
});
}
}
});
} It's not really doing what you need, but I think you could just modify it. This snippet takes all our About the inline |
I'll try. thanks! |
I generate a schema of this type,
and generated stuff was
, the
anyOf
of objects.and generated result on storybook was,
is there any method to resolve
anyof
schema correctly?The text was updated successfully, but these errors were encountered: