interagent/pliny

Schema Path Wrong On Scaffold

kennyp opened this issue · 5 comments

Looks like the wrong schema path is used on scaffold. It uses /docs/schema.json instead of /schema/schema.json

To reproduce I ran:

#!/usr/bin/env bash

set -e
pliny-new 'test-pliny'
cd 'test-pliny'
sed -i 's|gem "rollbar"| gem "rollbar", require: "rollbar/middleware/sinatra"|' Gemfile
./bin/setup
pliny-generate scaffold chicken
sed -i 's|\(# mount all endpoints here\)|\1\nmount Endpoints::Chickens|' lib/routes.rb
bundle exec rake db:migrate
bundle exec rake

If I do add

sed -i 's|/docs/schema.json|/schema/schema.json|' spec/acceptance/chickens_spec.rb

I then get a "Content-Type" response header must be set to "application/json"

After that if I add

sed -i "s|content_type :json, charset: 'utf-8'|content_type :json|" lib/endpoints/chickens.rb

everything works as expected

These are probably different parts all not playing nice together. I know the last one comes from committee some how and I don't think we want to drop the utf-8 from the content type.

@kennyp Hey, thanks for the bug report! #139 should fix the first problem that you mentioned.

Regarding the one relating to content types, this bug was recently patched in Committee in interagent/committee#67. Can you try a bundle update committee and see if you can get 1.7.1. Thanks!

Hey @brandur
I pulled down the latest pliny and it fixed the rollbar and schema.json issues, but even with committee 1.7.1 I still get the content type bug.

Here's my updated test script script:

#!/usr/bin/env bash

set -e
rm -rf 'test-pliny'
gem update pliny
gem update committee
pliny-new 'test-pliny'
cd 'test-pliny'
./bin/setup
bundle update committee
pliny-generate scaffold chicken
sed -i 's|\(# mount all endpoints here\)|\1\nmount Endpoints::Chickens|' lib/routes.rb
bundle exec rake db:migrate
bundle exec rake

@kennyp Ouch, I'd forgotten that we hadn't actually pulled in interagent/committee#70.

Can you try updating to Committee 1.7.2? I just did and your test script passes for me now.

👍 Works like a champ now. Thanks @brandur