JSON file throws an apimodel.UnrecognizedField: Found unrecognized field swagger while YAML is not

Hi Team,

I have a swagger.json file which I am trying to import throws an error but when I convert that into YAML file gives sucess.

Errors:

{
  "code" : "apimodel.UnrecognizedField",
  "message" : "Found unrecognized field swagger.",
  "contexts" : [ ]
}


apimodel.UnrecognizedField: Found unrecognized field swagger

Actually I have added tags in it, which looks like the following. Do you have any idea, why this behavior?

"post": {
  "summary": "This is summary of test api",
  "tags": [
    "Tag 1",
    "Tag 2",
    "Tag 3",
  ],
}
0 5 293
5 REPLIES 5

@Veera Prasad , I don't think it's because of tags. Can you attach sample swagger.json to reproduce same ?

Not applicable

Could you please paste the whole code here?

Your code likes fine except there is a "," at the end of tags.

Can you check your local code if it is the same issue?

@Anil Sagar, @whitman zhang. Thank you for the reply. I could not provide actual contents in the swagger due to security issue. I have just replaced actual content to sample.

Hi Veera,

can you please de-face the security-related data in your .json file and maybe trim it down to a minimal reproducible datagram, ie., remove part of the documents until you can still replicate your problem.

Hi,

Actually, It works when I remove the tags from the JSON file. And It worked when I convert same file into YAML along with tags. Got Surprised. Not sure what is going wrong in the JSON file. As mentioned by @whitman zhang, I have removed "," at the end of tags. Still same issue.

Regards,

Veera