FAQ

  • GitHub GitHub Repo stars
  • Discord Discord Server
  • ✨ New! Try the OpenAPI Doctor ✨ The OpenAPI Doctor

    duplicatePaths


    duplicatePaths analyzes the raw YAML structure of an OpenAPI specification to detect duplicate path definitions before they’re processed by the OpenAPI parser.

    Since YAML allows duplicate keys but only retains the last occurrence, duplicate path definitions in OpenAPI specs result in silent data loss where earlier path definitions are discarded without warning. This function catches these issues at the YAML parsing level.

    The function scans the paths section of the specification and identifies when the same path key appears multiple times, reporting each duplicate occurrence after the first one.

    Example ruleset configuration

    duplicate-paths:
      description: "Check for duplicate paths that cause silent data loss"
      type: "validation"
      recommended: true
      severity: "error"
      given: "$"
      resolved: false  # Requires raw YAML nodes to detect duplicates
      then:
        function: "duplicatePaths"
    

    The function is used by the duplicate-paths Rule


    View Function Source