cyclosproject / ng-openapi-gen

An OpenAPI 3.0 codegen for Angular
MIT License
397 stars 132 forks source link

Models are not generating #265

Closed JustinM16 closed 1 year ago

JustinM16 commented 1 year ago

I cannot get my models to generate.

My Config File is:

{ "$schema": "https://raw.githubusercontent.com/cyclosproject/ng-openapi-gen/master/ng-openapi-gen-schema.json", "input": "http://localhost:8080/v2/api-docs", "output": "src/app/api", "ignoreUnusedModels": false }

The Command I'm using is: ng-openapi-gen -c ng-openapi-gen.json

and the console output is: Generation from http://localhost:8080/v2/api-docs finished with 0 models and 2 services.

My input is: { "swagger": "2.0", "info": { "description": "Api Documentation", "version": "1.0", "title": "Api Documentation", "termsOfService": "urn:tos", "contact": {}, "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0" } }, "host": "localhost:8080", "basePath": "/", "tags": [ { "name": "basic-error-controller", "description": "Basic Error Controller" }, { "name": "user-controller", "description": "User Controller" } ], "paths": { "/error": { "get": { "tags": [ "basic-error-controller" ], "summary": "error", "operationId": "errorUsingGET", "produces": [ "/" ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "object" } } }, "401": { "description": "Unauthorized" }, "403": { "description": "Forbidden" }, "404": { "description": "Not Found" } } }, "head": { "tags": [ "basic-error-controller" ], "summary": "error", "operationId": "errorUsingHEAD", "consumes": [ "application/json" ], "produces": [ "/" ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "object" } } }, "204": { "description": "No Content" }, "401": { "description": "Unauthorized" }, "403": { "description": "Forbidden" } } }, "post": { "tags": [ "basic-error-controller" ], "summary": "error", "operationId": "errorUsingPOST", "consumes": [ "application/json" ], "produces": [ "/" ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "object" } } }, "201": { "description": "Created" }, "401": { "description": "Unauthorized" }, "403": { "description": "Forbidden" }, "404": { "description": "Not Found" } } }, "put": { "tags": [ "basic-error-controller" ], "summary": "error", "operationId": "errorUsingPUT", "consumes": [ "application/json" ], "produces": [ "/" ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "object" } } }, "201": { "description": "Created" }, "401": { "description": "Unauthorized" }, "403": { "description": "Forbidden" }, "404": { "description": "Not Found" } } }, "delete": { "tags": [ "basic-error-controller" ], "summary": "error", "operationId": "errorUsingDELETE", "produces": [ "/" ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "object" } } }, "204": { "description": "No Content" }, "401": { "description": "Unauthorized" }, "403": { "description": "Forbidden" } } }, "options": { "tags": [ "basic-error-controller" ], "summary": "error", "operationId": "errorUsingOPTIONS", "consumes": [ "application/json" ], "produces": [ "/" ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "object" } } }, "204": { "description": "No Content" }, "401": { "description": "Unauthorized" }, "403": { "description": "Forbidden" } } }, "patch": { "tags": [ "basic-error-controller" ], "summary": "error", "operationId": "errorUsingPATCH", "consumes": [ "application/json" ], "produces": [ "/" ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "object" } } }, "204": { "description": "No Content" }, "401": { "description": "Unauthorized" }, "403": { "description": "Forbidden" } } } }, "/user/authenticate": { "post": { "tags": [ "user-controller" ], "summary": "authenticateUser", "operationId": "authenticateUserUsingPOST", "consumes": [ "application/json" ], "produces": [ "application/json" ], "parameters": [ { "in": "body", "name": "request", "description": "request", "required": true, "schema": { "$ref": "#/definitions/AuthenticateUser_Request" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/AuthenticateUser_Response" } }, "201": { "description": "Created" }, "401": { "description": "Unauthorized" }, "403": { "description": "Forbidden" }, "404": { "description": "Not Found" } } } }, "/user/checkEmailAvailability": { "post": { "tags": [ "user-controller" ], "summary": "checkEmailAvailability", "operationId": "checkEmailAvailabilityUsingPOST", "consumes": [ "application/json" ], "produces": [ "application/json" ], "parameters": [ { "in": "body", "name": "request", "description": "request", "required": true, "schema": { "$ref": "#/definitions/CheckEmailAvailability_Request" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/ApiResult" } }, "201": { "description": "Created" }, "401": { "description": "Unauthorized" }, "403": { "description": "Forbidden" }, "404": { "description": "Not Found" } } } }, "/user/createUser": { "post": { "tags": [ "user-controller" ], "summary": "createUser", "operationId": "createUserUsingPOST", "consumes": [ "application/json" ], "produces": [ "application/json" ], "parameters": [ { "in": "body", "name": "request", "description": "request", "required": true, "schema": { "$ref": "#/definitions/CreateUser_Request" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/ApiResult" } }, "201": { "description": "Created" }, "401": { "description": "Unauthorized" }, "403": { "description": "Forbidden" }, "404": { "description": "Not Found" } } } } }, "definitions": { "ApiResult": { "type": "object", "properties": { "errors": { "type": "array", "items": { "$ref": "#/definitions/ValidationError" } }, "good": { "type": "boolean" }, "message": { "type": "string" }, "stackTrace": { "type": "string" }, "status": { "type": "integer", "format": "int32" } }, "title": "ApiResult" }, "AuthenticateUser_Request": { "type": "object", "properties": { "email": { "type": "string" }, "password": { "type": "string" } }, "title": "AuthenticateUser_Request" }, "AuthenticateUser_Response": { "type": "object", "properties": { "errors": { "type": "array", "items": { "$ref": "#/definitions/ValidationError" } }, "good": { "type": "boolean" }, "message": { "type": "string" }, "stackTrace": { "type": "string" }, "status": { "type": "integer", "format": "int32" }, "token": { "type": "string" } }, "title": "AuthenticateUser_Response" }, "CheckEmailAvailability_Request": { "type": "object", "properties": { "email": { "type": "string" } }, "title": "CheckEmailAvailability_Request" }, "CreateUser_Request": { "type": "object", "properties": { "email": { "type": "string" }, "password": { "type": "string" }, "roles": { "type": "array", "items": { "type": "string", "enum": [ "ADMIN", "MANAGER", "USER" ] } } }, "title": "CreateUser_Request" }, "ModelAndView": { "type": "object", "properties": { "empty": { "type": "boolean" }, "model": { "type": "object" }, "modelMap": { "type": "object", "additionalProperties": { "type": "object" } }, "reference": { "type": "boolean" }, "status": { "type": "string", "enum": [ "ACCEPTED", "ALREADY_REPORTED", "BAD_GATEWAY", "BAD_REQUEST", "BANDWIDTH_LIMIT_EXCEEDED", "CHECKPOINT", "CONFLICT", "CONTINUE", "CREATED", "DESTINATION_LOCKED", "EXPECTATION_FAILED", "FAILED_DEPENDENCY", "FORBIDDEN", "FOUND", "GATEWAY_TIMEOUT", "GONE", "HTTP_VERSION_NOT_SUPPORTED", "IM_USED", "INSUFFICIENT_SPACE_ON_RESOURCE", "INSUFFICIENT_STORAGE", "INTERNAL_SERVER_ERROR", "I_AM_A_TEAPOT", "LENGTH_REQUIRED", "LOCKED", "LOOP_DETECTED", "METHOD_FAILURE", "METHOD_NOT_ALLOWED", "MOVED_PERMANENTLY", "MOVED_TEMPORARILY", "MULTIPLE_CHOICES", "MULTI_STATUS", "NETWORK_AUTHENTICATION_REQUIRED", "NON_AUTHORITATIVE_INFORMATION", "NOT_ACCEPTABLE", "NOT_EXTENDED", "NOT_FOUND", "NOT_IMPLEMENTED", "NOT_MODIFIED", "NO_CONTENT", "OK", "PARTIAL_CONTENT", "PAYLOAD_TOO_LARGE", "PAYMENT_REQUIRED", "PERMANENT_REDIRECT", "PRECONDITION_FAILED", "PRECONDITION_REQUIRED", "PROCESSING", "PROXY_AUTHENTICATION_REQUIRED", "REQUESTED_RANGE_NOT_SATISFIABLE", "REQUEST_ENTITY_TOO_LARGE", "REQUEST_HEADER_FIELDS_TOO_LARGE", "REQUEST_TIMEOUT", "REQUEST_URI_TOO_LONG", "RESET_CONTENT", "SEE_OTHER", "SERVICE_UNAVAILABLE", "SWITCHING_PROTOCOLS", "TEMPORARY_REDIRECT", "TOO_EARLY", "TOO_MANY_REQUESTS", "UNAUTHORIZED", "UNAVAILABLE_FOR_LEGAL_REASONS", "UNPROCESSABLE_ENTITY", "UNSUPPORTED_MEDIA_TYPE", "UPGRADE_REQUIRED", "URI_TOO_LONG", "USE_PROXY", "VARIANT_ALSO_NEGOTIATES" ] }, "view": { "$ref": "#/definitions/View" }, "viewName": { "type": "string" } }, "title": "ModelAndView" }, "ValidationError": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" } }, "title": "ValidationError" }, "View": { "type": "object", "properties": { "contentType": { "type": "string" } }, "title": "View" } } }

JustinM16 commented 1 year ago

I fixed it!

The problem was that my Server was using Springfox for swagger2 and swagger-ui which isn't support with cyclosproject fully it looks like. I had to change my Server to use Springfox 3 and generate the api-docs using Open Api 3. So now my input url is "http://localhost:8080/v3/api-docs" and I am now getting my models all generated.