create-client
create-client copied to clipboard
TypeError: Cannot read property 'status' of undefined on generating frontend code
Hallo I'm trying to get the client code generator running:
I have an api which returns something like this:
christophs-mbp:test htz$ curl http://handicap-berechnen.lo/api
{"@context":"\/api\/contexts\/Entrypoint","@id":"\/api","@type":"Entrypoint","club":"\/api\/clubs","course":"\/api\/courses","teeBox":"\/api\/tee_boxes"}
but running the generator results in an error:
christophs-mbp:test htz$ generate-api-platform-client http://handicap-berechnen.lo/api src
TypeError: Cannot read property 'status' of undefined
at /Users/christophhautzinger/.config/yarn/global/node_modules/@api-platform/api-doc-parser/lib/hydra/parseHydraDocumentation.js:295:134
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:160:7)
the same error as on any non existant api endpoint url:
calling the demo code works:
christophs-mbp:test htz$ generate-api-platform-client https://demo.api-platform.com src/
Code for the "Review" resource type has been generated!
Paste the following definitions in your application configuration:
// import reducers
import review from './reducers/review/';
//import routes
import reviewRoutes from './routes/review';
// Add the reducer
combineReducers(review,{/* ... */}),
// Add routes to <Switch>
{ reviewRoutes }
Code for the "Book" resource type has been generated!
Paste the following definitions in your application configuration:
// import reducers
import book from './reducers/book/';
//import routes
import bookRoutes from './routes/book';
// Add the reducer
combineReducers(book,{/* ... */}),
// Add routes to <Switch>
{ bookRoutes }
my node version is
christophs-mbp:test htz$ node -v
v9.3.0
Do i need some special kind of configuration? didn't get it from the docs.
try to run this on your api https://www.npmjs.com/package/api-platform-doc-parsing-check
thanks for your reply!
actually, it is the same problem:
christophs-mbp:frontend htz$ node node_modules/api-platform-doc-parsing-check/lib/index.js https://handicap-berechnen.lo/api
TypeError: Cannot read property 'status' of undefined
at /private/var/www/handicap-berechnen.de/frontend/node_modules/api-doc-parser/lib/hydra/parseHydraDocumentation.js:278:134
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:160:7)
the demo api runs smoothly:
christophs-mbp:frontend htz$ node node_modules/api-platform-doc-parsing-check/lib/index.js https://demo.api-platform.com
Checking documentation parsing for API @ https://demo.api-platform.com
[ 'books', 'reviews' ]
Number of endpoints parsed : 2
you must have a problem with your son api documentation. Try postman to see what do you get for documentation and compare with demo api
Got the same error while following Book/Review tutorial. What is postman?
@danaki https://www.getpostman.com
Hallo I'm trying to get the client code generator running:
I have an api which returns something like this:
christophs-mbp:test htz$ curl http://handicap-berechnen.lo/api {"@context":"\/api\/contexts\/Entrypoint","@id":"\/api","@type":"Entrypoint","club":"\/api\/clubs","course":"\/api\/courses","teeBox":"\/api\/tee_boxes"}
but running the generator results in an error:
christophs-mbp:test htz$ generate-api-platform-client http://handicap-berechnen.lo/api src TypeError: Cannot read property 'status' of undefined at /Users/christophhautzinger/.config/yarn/global/node_modules/@api-platform/api-doc-parser/lib/hydra/parseHydraDocumentation.js:295:134 at <anonymous> at process._tickCallback (internal/process/next_tick.js:160:7)
the same error as on any non existant api endpoint url:
calling the demo code works:
christophs-mbp:test htz$ generate-api-platform-client https://demo.api-platform.com src/ Code for the "Review" resource type has been generated! Paste the following definitions in your application configuration: // import reducers import review from './reducers/review/'; //import routes import reviewRoutes from './routes/review'; // Add the reducer combineReducers(review,{/* ... */}), // Add routes to <Switch> { reviewRoutes } Code for the "Book" resource type has been generated! Paste the following definitions in your application configuration: // import reducers import book from './reducers/book/'; //import routes import bookRoutes from './routes/book'; // Add the reducer combineReducers(book,{/* ... */}), // Add routes to <Switch> { bookRoutes }
my node version is
christophs-mbp:test htz$ node -v v9.3.0
Do i need some special kind of configuration? didn't get it from the docs.
Hello, have you found a solution ? i the same error