Forum Discussion
RonRatovsky
Moderator
Hello,
There are several issues here.
First, your API definition is invalid, and SwaggerHub should show you were. Generally speaking, `null` is not a valid value, so anything with that value would need to be either erased or given a valid value.
The second part is that you're trying to describe an OAuth2 security process using direct API paths, which is not the right approach with the OpenAPI Specification. You can find out more about how to define OAuth2 in your definitions through https://swagger.io/docs/specification/2-0/authentication.
pranabpal
6 years agoNew Contributor
from this code i cannot able to create json though this code is valid in swaggerhub
{ "swagger" : "2.0", "info" : { "description" : "", "version" : "1.0.0", "title" : "", "termsOfService" : "", "contact" : "", "license" :"" }, "host" : "login.microsoftonline.com", "basePath":"\/", "responses":{ "200":{ "description":"OK", "schema":{ "title":"ResponseOfIdentity", "type":"object", "properties":{ "access_token":{ "type":"string" }, "scope":{ "type":"string" }, "expires_in":{ "type":"integer" }, "token_type":{ "type":"string", "enum":[ "bearer" ] } } } } }, "tags":[ { "name":"test10", } ], "schemes" : [ "https" ], "paths" : { "/ada8448e-faae-4047-99a6-15a17f4db850/oauth2/token" : { "post" : { "tags" : [ "test10" ], "summary" : null, "description" : null, "operationId" : "test10", "produces" : [ "application/json" ], "consumes" : [ "application/x-www-form-urlencoded" ], "parameters" : [ { "name" : "Subscription_Key", "in" : "header", "description" : null, "required" : false, "type" : "string" }, { "name" : "grant_type", "in" : "formData", "description" : null, "required" : false, "type" : "string" }, { "name" : "client_id", "in" : "formData", "description" : null, "required" : false, "type" : "string" }, { "name" : "client_secret", "in" : "formData", "description" : null, "required" : false, "type" : "string" }], "responses":{ "200":{ "description":"OK", "schema" : { "$ref" : "#/definitions/test10" } } } } } }, "definitions" : { "test10" : { "type" : "object", "properties" : { "token_type" : { "type" : "string" }, "access_token" : { "type" : "string" } } } } }
code is valid in swaggerhub