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

Pre-calculate type aliases before processing models #6559

Merged
merged 1 commit into from
Oct 2, 2017

Commits on Sep 25, 2017

  1. Pre-calculate type aliases before processing models

    A type alias in this context is where a model is simply another name for a
    primitive type, such as `MyString` in the following model definitions:
    
        MyList:
          type: array
          items:
            $ref: '#/definitions/MyString'
        MyString:
          type: string
    
    It is valid to use a type alias as a property in another object or array model,
    even if the object/array is defined before the alias is, as in the example
    above. However, the current alias logic only looks "back" in list of previously
    defined models, meaning that `MyList` would not know that `MyString` is an
    alias. This change fixes the incorrect behavior by pre-calculating the list of
    aliases before any models are processed. It also changes the test endpoint to
    verify the correct behavior even when an object is defined before an alias it
    uses.
    Benjamin Douglas committed Sep 25, 2017
    Configuration menu
    Copy the full SHA
    31fc0a3 View commit details
    Browse the repository at this point in the history