bootprint / bootprint-openapi

Bootprint-module to render OpenAPI specifications, this repository has moved to https://github.com/bootprint/bootprint-monorepo/tree/master/packages/bootprint-openapi
MIT License
357 stars 48 forks source link

Definition objects not getting any details #26

Closed mewren closed 9 years ago

mewren commented 9 years ago

My Definition objects are mostly blank.

product

When I send my yaml file to a co-worker who is on an older version(0.6.2), it works fine for him. Another co-worker on the newer version has the same problem as me (0.6.5) I tried uninstalling and reinstalling to bootprint (0.7.1)and bootprint-swagger to (0.6.2) but I still get the same error, so I suspect it is another dependency that is causing the problem?

Suggestions?

nknapp commented 9 years ago

The relevant packages that are involved are bootprint-swagger, bootprint-json-schema and bootprint-base. They depend on each other in this order. From your screenshot I believe the problem might be with bootprint-json-schema. If you are brave and want to find the bug yourself, you could look into the call tree of the handlebars-partials. The json-schema-partials are not very well documented though.

Starting with bootprint@0.4.10 the versions of the used template packages (-swagger ,-json-schema, -base) should be printed on startup, so that might give some hints too.

If it is possible, you could also post your swagger-spec here and let me have a look.

And, if this were possible in writing, you could see me smile. I'm flattered that there are always new people asking questions, I wasn't expecting that when I started this project.

mewren commented 9 years ago

I un-installed then re-installed the specific versions to try to match my co-worker: npm -g install bootprint-base@0.5.0 npm -g install bootprint-json-schema@0.5.0 npm -g install bootprint-swagger@0.6.2

Now I get printed on startup: Loading bootprint-swagger 0.6.2 Loading bootprint-json-schema 0.5.1 Loading bootprint-base 0.5.1 done

I can't share my spec. Still don't know why the spec works for some of us, but not others. I tried PetStore yaml and it works, so will have to rip out sections until it works. Fun fun.

nknapp commented 9 years ago

What I would do is the following:

nknapp commented 9 years ago

Looking at the file, I may have an idea. Stupid thing... This part is probably responsible for it.

{{#if $ref}}
    {{>json-schema/reference $ref}}
{{else ifeq type 'object'}}
    {{>json-schema/properties}}
    {{#if additionalProperties}}
        {{>json-schema/additionalProperties additionalProperties}}
    {{/if}}
{{else ifeq type 'array'}}
    {{>json-schema/array-items items}}
{{else}}
    {{>json-schema/datatype .}}
{{/if}}

You don't have explicitly set type: object on your definition, do you? Then this will only print the object. The part changed in the last release of bootprint-json-schema due to #18

nknapp commented 9 years ago

I'm looking into it right now. I think I have a solution, but I'm currently having some side-effects

nknapp commented 9 years ago

Make sure you now use bootprint-json-schema@0.5.2, which I have just published. It should resolve the bug. Can you verify that?

nknapp commented 9 years ago

I'm closing this issue. If you have any more problems, please either comment here or create a new issue. I hope I could help you.