Skip to content

Allow OPENAPI_URL_PREFIX to be '/' #13

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

Closed
wants to merge 1 commit into from

Conversation

fbergroth
Copy link

If OPENAPI_URL_PREFIX == '/', _add_leading_slash is being called with an empty string and crashes with an IndexError.

@coveralls
Copy link

coveralls commented Oct 10, 2018

Coverage Status

Coverage remained the same at 99.622% when pulling f498159 on fbergroth:fix-prefix into 2f0544a on Nobatek:master.

@lafrech
Copy link
Member

lafrech commented Oct 10, 2018

Nice catch.

I didn't think of putting the docs at the root of the application, but thinking of it, I find it better and I might do the same in my apps in the future. If OPENAPI_REDOC_PATH is also / (or ''), the landing page of the app will be the documentation page, which is nice.

I did a few more modifications in bfcda78 to allow this.

Thanks for the suggestion.

@lafrech lafrech closed this Oct 10, 2018
@fbergroth
Copy link
Author

@lafrech alright, cool. I'm just started out with this library, so I'll be blunt and hijack this PR to ask a question. Is there any simple way to make a mixed type? I'm trying to make a custom field that renders this type:

oneOf:
  - type: string
  - type: array
    items:
      type: string

@fbergroth fbergroth deleted the fix-prefix branch October 10, 2018 14:21
@lafrech
Copy link
Member

lafrech commented Oct 10, 2018

You can bake a custom marshmallow field that would do that.

Regarding the documentation, I don't know. Polymorphism is still a complicated thing: marshmallow-code/apispec#182.

I think if we implemented the FIELD_TO_PROPERTY mapping I'm suggesting in marshmallow-code/apispec#172 (comment), you could have a workaround. Maybe a bit too manual, but better than nothing.

@fbergroth
Copy link
Author

Thanks for linking these issues.

I think if we implemented the FIELD_TO_PROPERTY mapping I'm suggesting in marshmallow-code/apispec#172 (comment), you could have a workaround. Maybe a bit too manual, but better than nothing.

I think ret.update may not be enough. For my use-case, I would need to also remove some keys (type) of ret. I guess I'll have to resort to monkey patching for now.

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

Successfully merging this pull request may close these issues.

3 participants