Skip to content

How to "merge" allOfs #94

@alexbt

Description

@alexbt

My swagger.json is split into 2 files with a the definition kept in definition.json.

I resolve all $ref with the following:

specDoc, _ := loads.Spec(swaggerFile)
exp, _ := specDoc.Expanded()
writeToFile(*exp.Spec(), "swaggerExpanded.json")

If there a way to merge the multiple levels of allOf into a single list of properties ? To avoid the following:

"allOf": [
{
    "description": "Product detail",
    "type": "object",
    "title": "Product",
    "allOf": [
    {
        "type": "object",
        "title": "HalResourceSupport",
        "allOf": [
        {
        "type": "object",
        "title": "ResourceSupport",
        ...

I tried analysis.Flatten but it doesn't seem to do what I'm looking for.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions