Skip to content

Localhost Self Signed SSL cert fails to download swagger.json #276

Closed
@warrenbuckley

Description

@warrenbuckley

Description

I have a .NETCore webserver hosting/serving a swagger file that is running on localhost over https with a self signed SSL certificate. But trying to do so I get the following error.

> [email protected] openapi-ts
> openapi-ts --input https://localhost:44312/umbraco/swagger/AccessibilityReporter/swagger.json --output src/Api

{
  stack: 'JSONParserError: Error downloading https://localhost:44312/umbraco/swagger/AccessibilityReporter/swagger.json \n' +
    'fetch failed\n' +
    '    at download (C:\\Code\\Contrib\\umbraco-accessibility-reporter\\src\\AccessibilityReporter\\client\\node_modules\\@apidevtools\\json-schema-ref-parser\\dist\\lib\\resolvers\\http.js:113:15)\n' +
    '    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)',
  code: 'ERESOLVER',
  name: 'ResolverError',
  message: 'Error downloading https://localhost:44312/umbraco/swagger/AccessibilityReporter/swagger.json \n' +  
    'fetch failed',
  source: 'https://localhost:44312/umbraco/swagger/AccessibilityReporter/swagger.json',
  path: null,
  toJSON: [Function: toJSON],
  footprint: 'null+https://localhost:44312/umbraco/swagger/AccessibilityReporter/swagger.json+ERESOLVER+Error downloading https://localhost:44312/umbraco/swagger/AccessibilityReporter/swagger.json \n' +
    'fetch failed',
  toString: [Function: toString]
}

OpenAPI specification (optional)

{
    "openapi": "3.0.1",
    "info": {
        "title": "Accessibility Reporter Package API",
        "version": "1.0"
    },
    "paths": {
        "/umbraco/accessibilityreporter/api/v1/config/current": {
            "get": {
                "tags": [
                    "Config"
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "oneOf": [
                                            {
                                                "$ref": "#/components/schemas/NodeSummary"
                                            }
                                        ]
                                    }
                                }
                            },
                            "text/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "oneOf": [
                                            {
                                                "$ref": "#/components/schemas/NodeSummary"
                                            }
                                        ]
                                    }
                                }
                            },
                            "text/plain": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "oneOf": [
                                            {
                                                "$ref": "#/components/schemas/NodeSummary"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The resource is protected and requires an authentication token"
                    }
                },
                "security": [
                    {
                        "Backoffice User": []
                    }
                ]
            }
        },
        "/umbraco/accessibilityreporter/api/v1/pages": {
            "get": {
                "tags": [
                    "Directory"
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "oneOf": [
                                            {
                                                "$ref": "#/components/schemas/NodeSummary"
                                            }
                                        ]
                                    }
                                }
                            },
                            "text/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "oneOf": [
                                            {
                                                "$ref": "#/components/schemas/NodeSummary"
                                            }
                                        ]
                                    }
                                }
                            },
                            "text/plain": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "oneOf": [
                                            {
                                                "$ref": "#/components/schemas/NodeSummary"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The resource is protected and requires an authentication token"
                    }
                },
                "security": [
                    {
                        "Backoffice User": []
                    }
                ]
            }
        }
    },
    "components": {
        "schemas": {
            "NodeSummary": {
                "required": [
                    "docTypeAlias",
                    "guid",
                    "id",
                    "name",
                    "url"
                ],
                "type": "object",
                "properties": {
                    "guid": {
                        "type": "string",
                        "format": "uuid",
                        "readOnly": true
                    },
                    "id": {
                        "type": "integer",
                        "format": "int32",
                        "readOnly": true
                    },
                    "name": {
                        "type": "string",
                        "readOnly": true
                    },
                    "docTypeAlias": {
                        "type": "string",
                        "readOnly": true
                    },
                    "url": {
                        "type": "string"
                    }
                },
                "additionalProperties": false
            }
        },
        "securitySchemes": {
            "Backoffice User": {
                "type": "oauth2",
                "description": "Umbraco Authentication",
                "flows": {
                    "authorizationCode": {
                        "authorizationUrl": "/umbraco/management/api/v1/security/back-office/authorize",
                        "tokenUrl": "/umbraco/management/api/v1/security/back-office/token",
                        "scopes": {}
                    }
                }
            }
        }
    }
}

Configuration

openapi-ts --input https://localhost:44312/umbraco/swagger/AccessibilityReporter/swagger.json --output src/Api

System information (optional)

OS: Windows 11
NPM: 10.2.4
Node: 20.11.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🔥Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions