Hi,
I see this error at bottom of API doc, but have no idea to fix this
{"schemaValidationMessages":[{"level":"error","message":"Can't read from file http://dev.api.local/apidoc.json"}]}
Thank's for your help
Bertrand
Could you please send us the result of apidoc.json and the api-platform format configuration ?
@Simperfit I don't have the file apidoc.json on web folder. This error appears at the bottom of API Doc. I use the new Swagger-UI.
My api config:
# API Platform:
api_platform:
title: 'title'
description: 'description'
version: 1.0.0
collection:
pagination:
items_per_page: 10
Do you have anything related to the formats ?
What happen if you do GET /apidoc.json ?
I receive a json with some infos:
{"swagger":"2.0","info":{"title":"title","description":"description","version":" ...
In this response, i see this (multiple)
,"404":{"description":"Resource not found"} …
But my API work fine. Strange.
Thank's for your help
@Garfield-fr : We will check together if you have the good configuration :
doc:
resource: '@ApiPlatformBundle/Resources/config/routing/swagger-ui.xml'
api_platform:
title: "%api_name%"
description: "%api_description%"
formats:
jsonld: ['application/ld+json']
json: ['application/json']
GET /doc you should have the doc, here is one of my entity : 
@Garfield-fr is it ok for you ?
@Simperfit Sorry for the spam, but it doesn't work. I always see the error on bottom right of API Doc. But my API work correctly. Very Strange.
@Garfield-fr Need more info. Please help us help you, by showing us the exception stack trace at least? (You can find it in the Symfony Profiler.)
I use the last commit on Master for my test (2.0-dev) and new swagger-ui interface

{"swagger":"2.0","info":{"title":"XXX API","description":"XXX API","version":"1.0.0"},"definitions":{"Item":{"type":"object","xml":{"name":"response"},"properties":{"id":{"type":"string"},"bibId":{"type":"integer"},"location":{"type":"integer"},"shelfLocation":{"type":"integer"},"barcode":{"type":"string"},"copyno":{"type":"integer"},"callNumber":{"type":"string"},"secondCallNumber":{"type":"string"},"itemClass":{"type":"string"},"publicNote":{"type":"string"},"author":{"type":"string"},"title":{"type":"string"}}},"Location":{"type":"object","xml":{"name":"response"},"properties":{"id":{"type":"string"},"name":{"type":"string"}}},"Patron":{"type":"object","xml":{"name":"response"},"properties":{"id":{"type":"string"},"lastname":{"type":"string"},"prefix":{"type":"string"}}},"Reserve":{"type":"object","xml":{"name":"response"},"properties":{"course":{"type":"string"},"section":{"type":"string"},"courseTitle":{"type":"string"},"instructors":{"$ref":"#\/definitions\/Patron"},"items":{"type":"string","example":"\/my\/iri"}}},"ReserveItem":{"type":"object","xml":{"name":"response"},"properties":{"id":{"type":"string"},"beginDate":{"type":"string","example":"1988-01-21T00:00:00+00:00"},"endDate":{"type":"string","example":"1988-01-21T00:00:00+00:00"},"itemClassId":{"type":"integer"},"locationId":{"type":"integer"},"allowRequests":{"type":"integer"},"reserveState":{"type":"integer"},"reserve":{"type":"string","example":"\/my\/iri"},"item":{"type":"string","example":"\/my\/iri"}}},"BibliographicRecord":{"type":"object","xml":{"name":"response"},"properties":{"id":{"type":"string"},"recordId":{"type":"string"},"originalRecordId":{"type":"string"},"sourceId":{"type":"string"},"ilsApiId":{"type":"string"},"reroId":{"type":"string"},"local":{"type":"boolean"},"type":{"type":"string"},"title":{"type":"string"},"creator":{"type":"string"},"publisher":{"type":"string"},"creationDate":{"type":"string"},"format":{"type":"string"},"language":{"type":"string"},"contributor":{"type":"string"},"edition":{"type":"string"},"isPartOf":{"type":"string"},"identifier":{"type":"null"},"subject":{"type":"string"},"description":{"type":"string"},"relation":{"type":"string"},"source":{"type":"string"},"coverage":{"type":"string"},"rights":{"type":"string"},"libraryLevelAvailability":{"type":"string"},"vernacularTitle":{"type":"string"},"uniformTitle":{"type":"string"},"citation":{"type":"string"},"courseInfo":{"type":"string"},"additionalFields":{"type":"null"},"availlibrary":{"type":"null"}}},"Facet":{"type":"object","xml":{"name":"response"},"properties":{"id":{"type":"string"},"name":{"type":"string"},"count":{"type":"integer"}}},"ItemInfos":{"type":"object","xml":{"name":"response"},"properties":{"id":{"type":"string"},"barcode":{"type":"string"},"callNumber":{"type":"string"},"callNumber2":{"type":"string"},"displayPatronNodeField":{"type":"boolean"},"displayRequestButton":{"type":"boolean"},"itemClassName":{"type":"string"},"locationCode":{"type":"string"},"locationNames":{"type":"null"},"note":{"type":"string"},"requestQueue":{"type":"string"},"statusName":{"type":"string"},"units":{"type":"string"}}}},"externalDocs":{"description":"Find more about API Platform","url":"https:\/\/api-platform.com"},"tags":[{"name":"Item","externalDocs":{"url":"#Item"}},{"name":"Location","externalDocs":{"url":"#Location"}},{"name":"Patron","externalDocs":{"url":"#Patron"}},{"name":"Reserve","externalDocs":{"url":"#Reserve"}},{"name":"ReserveItem","externalDocs":{"url":"#ReserveItem"}},{"name":"BibliographicRecord","externalDocs":{"url":"#BibliographicRecord"}},{"name":"Facet","externalDocs":{"url":"#Facet"}},{"name":"ItemInfos","externalDocs":{"url":"#ItemInfos"}}],"paths":{"\/items":{"get":{"tags":["Item"],"produces":["application\/ld+json","application\/json"],"summary":"Retrieves the collection of Item resources.","responses":{"200":{"description":"Successful operation","schema":{"type":"array","items":{"$ref":"#\/definitions\/Item"}}}}}},"\/items\/{id}":{"get":{"tags":["Item"],"produces":["application\/ld+json","application\/json"],"summary":"Retrieves Item resource.","parameters":[{"name":"id","in":"path","required":true,"type":"integer"}],"responses":{"200":{"description":"Successful operation","schema":{"$ref":"#\/definitions\/Item"}},"404":{"description":"Resource not found"}}}},"\/patrons":{"get":{"tags":["Patron"],"produces":["application\/ld+json","application\/json"],"summary":"Retrieves the collection of Patron resources.","responses":{"200":{"description":"Successful operation","schema":{"type":"array","items":{"$ref":"#\/definitions\/Patron"}}}}}},"\/patrons\/{id}":{"get":{"tags":["Patron"],"produces":["application\/ld+json","application\/json"],"summary":"Retrieves Patron resource.","parameters":[{"name":"id","in":"path","required":true,"type":"integer"}],"responses":{"200":{"description":"Successful operation","schema":{"$ref":"#\/definitions\/Patron"}},"404":{"description":"Resource not found"}}}},"\/reserves":{"get":{"tags":["Reserve"],"produces":["application\/ld+json","application\/json"],"summary":"Retrieves the collection of Reserve resources.","responses":{"200":{"description":"Successful operation","schema":{"type":"array","items":{"$ref":"#\/definitions\/Reserve"}}}}}},"\/reserves\/{id}":{"get":{"tags":["Reserve"],"produces":["application\/ld+json","application\/json"],"summary":"Retrieves Reserve resource.","parameters":[{"name":"id","in":"path","required":true,"type":"integer"}],"responses":{"200":{"description":"Successful operation","schema":{"$ref":"#\/definitions\/Reserve"}},"404":{"description":"Resource not found"}}}},"\/bibliographic_records":{"get":{"tags":["BibliographicRecord"],"produces":["application\/ld+json","application\/json"],"summary":"Retrieves the collection of BibliographicRecord resources.","responses":{"200":{"description":"Successful operation","schema":{"type":"array","items":{"$ref":"#\/definitions\/BibliographicRecord"}}}}}},"\/bibliographic_records\/{id}":{"get":{"tags":["BibliographicRecord"],"produces":["application\/ld+json","application\/json"],"summary":"Retrieves BibliographicRecord resource.","parameters":[{"name":"id","in":"path","required":true,"type":"integer"}],"responses":{"200":{"description":"Successful operation","schema":{"$ref":"#\/definitions\/BibliographicRecord"}},"404":{"description":"Resource not found"}}}},"\/facets":{"get":{"tags":["Facet"]}},"\/facets\/{id}":{"get":{"tags":["Facet"]}},"\/items\/info\/{id}":{"get":{"tags":["ItemInfos"],"produces":["application\/ld+json","application\/json"],"summary":"Retrieves ItemInfos resource.","parameters":[{"name":"id","in":"path","required":true,"type":"integer"}],"responses":{"200":{"description":"Successful operation","schema":{"$ref":"#\/definitions\/ItemInfos"}},"404":{"description":"Resource not found"}}}}}}
Uhh so you're talking about the "404" keys in the Swagger spec. That's normal. HTTP status codes are used as keys.
Please check out the Swagger documentation: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#responses-object
@Garfield-fr Is it ok for you ?
Thanks to @teohhanhui, I think this can be closed
I guess @garfield-fr is speaking about the error logo at the bottom of the page. If you are using a local address like 127.0.0.1 it's normal: Swagger UI tries to validate the Swagger file using a remote web service. It sends the URL to this service, and the validator returns an error because it cannot reach the URL as it is not public. The error logo will be replaced by a green one when you will publish your API on a reachable server.
This can be closed @Garfield-fr ?
I have another question about this. It's possible to deactivate the external check, because my api is private (with protected access).
thank's
I think that this is already deactivated with the last master. Anyway you can always override this Twig template to fit your needs.
Perfect. Thank's
Most helpful comment
I guess @garfield-fr is speaking about the error logo at the bottom of the page. If you are using a local address like 127.0.0.1 it's normal: Swagger UI tries to validate the Swagger file using a remote web service. It sends the URL to this service, and the validator returns an error because it cannot reach the URL as it is not public. The error logo will be replaced by a green one when you will publish your API on a reachable server.