@Override
  protected Swagger read(Class<?> cls, String parentPath,
                         String parentMethod,
                         boolean readHidden,
                         String[] parentConsumes,
                         String[] parentProduces,
                         Map<String, Tag> parentTags,
                         List<Parameter> parentParameters) {
    NestedApiRecord nestedApiRecord = nestedAPIs.get(cls);
    if (null != nestedApiRecord) {
      logger.info("Processing nested API: {}", nestedApiRecord);
      List<Parameter> pathParameters = new ArrayList<>();
      SwaggerOverwriteNestedAPI swaggerOverwriteNestedAPI = AnnotationUtils.findAnnotation(nestedApiRecord.nestedApi,
        SwaggerOverwriteNestedAPI.class);
      if (null != swaggerOverwriteNestedAPI) {
        logger.info("Will use path params from @SwaggerOverwriteNestedAPI: {}", (Object[]) swaggerOverwriteNestedAPI
          .pathParameters());
        for (String param : swaggerOverwriteNestedAPI.pathParameters()) {
          PathParameter pathParam = new PathParameter();
          pathParam.setName(param);
          pathParam.setType(StringProperty.TYPE);
          pathParameters.add(pathParam);
        }
      } else {
        // Get the path parameters of the parent API method. All methods of the nested API class should include these
        // parameters.
        Operation operation = parseMethod(nestedApiRecord.parentMethod);
        pathParameters = ImmutableList.copyOf(
          Collections2.filter(operation.getParameters(), Predicates.instanceOf(PathParameter.class)));
        logger.info("Will copy path params from parent method: {}",
          Lists.transform(pathParameters, new ParameterToName()));
      }
      return super.read(cls,
          joinPaths(nestedApiRecord.parentApiPath, nestedApiRecord.parentMethodPath, parentPath),
          parentMethod, readHidden,
          parentConsumes, parentProduces, parentTags, pathParameters);
    }
    else {
      logger.info("Processing top level API: {}", cls.getSimpleName());
      return super.read(cls, parentPath, parentMethod, readHidden, parentConsumes, parentProduces, parentTags, parentParameters);
    }
  }
Original method is overwritten to handle nested api's properly
ambari-utility/src/main/java/org/apache/ambari/swagger/AmbariSwaggerReader.java