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

OpenApi fails on reading file #268

Closed
sirdawidd opened this issue Jun 9, 2023 · 2 comments
Closed

OpenApi fails on reading file #268

sirdawidd opened this issue Jun 9, 2023 · 2 comments
Assignees
Labels
waiting-8-days Closing after 8 days of waiting for the additional info requested.

Comments

@sirdawidd
Copy link

sirdawidd commented Jun 9, 2023

Hello,
I've tried to publish my openapi.json
When the file is read by library it throws an error:

[11:44:04 INF] Start processing HTTP request GET http://localhost:8080/camunda/swaggerui/openapi.json
[11:44:04 INF] Sending HTTP request GET http://localhost:8080/camunda/swaggerui/openapi.json
[11:44:04 INF] Received HTTP response headers after 17.694ms - 200
[11:44:04 INF] End processing HTTP request after 33.6067ms - 200
[11:44:04 ERR] An unhandled exception has occurred while executing the request.
System.UriFormatException: Invalid URI: The hostname could not be parsed.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)
at System.Uri..ctor(String uriString, UriKind uriKind)
at MMLib.SwaggerForOcelot.Transformation.SwaggerJsonTransformer.TransformOpenApi(JObject openApi, IEnumerable1 routes, String serverOverride, SwaggerEndPointOptions endPointOptions) at MMLib.SwaggerForOcelot.Transformation.SwaggerJsonTransformer.Transform(String swaggerJson, IEnumerable1 routes, String serverOverride, SwaggerEndPointOptions endPointOptions)
at MMLib.SwaggerForOcelot.Middleware.SwaggerForOcelotMiddleware.Invoke(HttpContext context, ISwaggerEndPointProvider swaggerEndPointRepository, IDownstreamSwaggerDocsRepository downstreamSwaggerDocs)
at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.InvokeCore(HttpContext context, PathString matchedPath, PathString remainingPath)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.MiddlewareAnalysis.AnalysisMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

File is generated automatically via openapi lib. Don't throw any error on https://editor.swagger.io/

https://github.com/sirdawidd/cammundaOpenApi/blob/main/openapi.json

@Burgyn
Copy link
Owner

Burgyn commented Jun 16, 2023

Hi @sirdawidd,

thanks for your issue. Unfortunately this package in this version does not support server definition like that:

{
  "url": "http://{host}:{port}/{contextPath}",
  "description": "The API server for the default process engine",
  "variables": {
    "host": {
      "default": "localhost"
    },
    "port": {
      "default": "8080"
    },
    "contextPath": {
      "default": "engine-rest"
    }
  }
}

If it's possible for you so replace url template for value http://localhost:8080/engine-rest or try open PR with fix. Problem is in the class SwaggerJsonTransformer, method TransformOpenApi line 106.

@Burgyn Burgyn added the waiting-8-days Closing after 8 days of waiting for the additional info requested. label Jun 16, 2023
@github-actions
Copy link

Closing after 8 days of waiting for the additional info requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-8-days Closing after 8 days of waiting for the additional info requested.
Projects
None yet
Development

No branches or pull requests

2 participants