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

[core] Extracting recommendations to validation framework #4979

Merged
merged 6 commits into from
Jan 31, 2020

Commits on Jan 31, 2020

  1. [core] Extracting recommendations to validation framework

    This is work to extract recommendation logic out of the CLI validate command
    into a shared evaluation instance which can be used elsewhere (such as Gradle,
    or the Online tool).
    
    For now, these validations are in addition to those provided by swagger-parser and
    are only the following recommendations:
    
    * Apache/Nginx warning that header values with underscore are dropped by default
    * Unused models/schemas
    * Use of properties with oneOf, which is ambiguous in OpenAPI Specification
    
    I've allowed for disabling recommendations via System properties, since this is
    something that has been requested a few times by users. System properties in this
    commit include:
    
    * openapi.generator.rule.recommendations=false
      - Allows for disabling recommendations completely. This wouldn't include all warnings
        and errors, only those we deem to be suggestions
    * openapi.generator.rule.apache-nginx-underscore=false
      - Allows for disabling the Apache/Nginx warning when header names have underscore
      - This is a legacy CGI configuration, and doesn't affect all web servers
    * openapi.generator.rule.oneof-properties-ambiguity=false
      - We support this functionality, but the specification may not intend for it
      - This is more to reduce noise
    * openapi.generator.rule.unused-schemas=false
      - We will warn when a schema is not referenced outside of Components, which
        users have requested to be able to turn off
    jimschubert committed Jan 31, 2020
    Configuration menu
    Copy the full SHA
    8885672 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3c1ef75 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    018ace7 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    2a5191f View commit details
    Browse the repository at this point in the history
  5. Add operation recommendation for GET/HEAD w/body

    Recommendation can be disabled via system property:
    
    -Dopenapi.generator.rule.anti-patterns.uri-unexpected-body=false
    jimschubert committed Jan 31, 2020
    Configuration menu
    Copy the full SHA
    5d4ab50 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    129d0e1 View commit details
    Browse the repository at this point in the history