Skip to content
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

Model with deep object references is truncated #463

Closed
makered opened this issue May 14, 2014 · 9 comments
Closed

Model with deep object references is truncated #463

makered opened this issue May 14, 2014 · 9 comments
Milestone

Comments

@makered
Copy link

makered commented May 14, 2014

If I have the following model:

{
    "Job": {
        "id": "Job",
        "properties": {
            "col1": {
                "$ref": "B"
            }
        }
    },
    "B": {
        "id": "B",
        "properties": {
            "col2": {
                "$ref": "C"
            }
        }
    },
    "C": {
        "id": "C",
        "properties": {
            "col3": {
                "type": "array",
                "items": {
                    "type":"string"
                }
            }
        }
    }
}

It will get presented in the UI as:

{
  "col1": {
    "col2": "C"
  }
}

Note how the C object is not rendered.

If I take the same model and add C as a child of Job as well:

{
    "Job": {
        "id": "Job",
        "properties": {
            "col1": {
                "$ref": "B"
            },
            "col4": {
                "$ref": "C"
            }
        }
    },
    "B": {
        "id": "B",
        "properties": {
            "col2": {
                "$ref": "C"
            }
        }
    },
    "C": {
        "id": "C",
        "properties": {
            "col3": {
                "type": "array",
                "items": {
                    "type":"string"
                }
            }
        }
    }
}

Then I get the following with C parsed in both locations:

{
  "col1": {
    "col2": {
      "col3": [
        ""
      ]
    }
  },
  "col4": {
    "col3": [
      ""
    ]
  }
}

Seems like I am hitting some kind of a nesting limit bug?

Thanks,

@fehguy
Copy link
Contributor

fehguy commented May 14, 2014

deep nesting should be supported just fine. Can you post your whole JSON file?

@makered
Copy link
Author

makered commented May 15, 2014

The example I gave is actually the complete model I am using and is what I had issues with, only changed label names.

@webron
Copy link
Contributor

webron commented May 15, 2014

I think Tony wanted to see the full JSON including the operations...
probably for testing purposes.

On Thu, May 15, 2014 at 9:02 AM, Ed Levin [email protected] wrote:

The example I gave is actually the complete model I am using and is what I
had issues with, only changed label names.


Reply to this email directly or view it on GitHubhttps://github.com//issues/463#issuecomment-43171449
.

@makered
Copy link
Author

makered commented May 15, 2014

Oh, sorry. I was just doing a test so not much content:

var param, sw, swe;
sw = require("swagger-node-express");
param = sw.params;
swe = sw.errors;
exports.addJob = {
  'spec': {
    description: "Add a job",
    path: "/v1/job",
    method: "POST",
    summary: "Add a job",
    notes: "Add a job",
    nickname: "addJob",
    produces: ["application/json"],
    parameters: [param.body("Job", "Job object", "Job")],
    responseMessages: [swe.invalid("job")]
  },
  'action': function(req, res) {
    return res.send(200);
  }
};

Also running swagger-node-express 2.0.2 and swagger-ui 2.0.16

@GStipick
Copy link

GStipick commented Aug 1, 2014

I am running into this issue as well.
After doing some testing, I am noticing that there is a possible cap where nesting of $ref models only goes 1 deep. makered's 2nd example worked is since the 'Job : col4' property directly calls the 'C' model from 1 layer deep. Since that model is loaded, it is then used to fill in the blanks for the 2nd nested layer 'Job : col1 -> B : col2' reference to the 'C' model.
Not sure if this is a swagger-ui problem or a swagger-js/swagger-node-express problem.
Using swagger-node-express 2.1.0 (with packaged swagger-ui)
Commit: [97e265e]
Date: Wednesday, July 16, 2014 5:53:33 PM

@fehguy
Copy link
Contributor

fehguy commented Feb 1, 2015

I believe this is fixed in M1, but will verify and close in M2.

@fehguy fehguy modified the milestones: v2.1.0-M2, v2.1.0-M1 Feb 1, 2015
@fehguy
Copy link
Contributor

fehguy commented Feb 22, 2015

fixed in 21d8a89

@fehguy fehguy closed this as completed Feb 22, 2015
@johncrim
Copy link

I'm seeing ulong values rounded off - could this be the same issue, or is it a new one?

Eg value 7286923155816383186 in my JSON is rounded to 7286923155816383000 in the UI.

I'm using "Swashbuckle.Core" version="5.3.2", so don't know what version of swagger this translates to.

@webron
Copy link
Contributor

webron commented Mar 31, 2016

@johncrim - no, that's #2030.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants