Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Feb 11 22:55

    mwpastore on namespace-dsl

    wip (compare)

  • Sep 08 2018 13:00
    jnylen closed #17
  • Feb 24 2018 10:59
    jannishuebl commented #18
  • Feb 23 2018 10:54
    jannishuebl opened #18
  • Dec 17 2017 06:34
    jnylen opened #17
  • Oct 27 2017 01:18

    mwpastore on master

    Update Sinatra dependencies (compare)

  • Oct 27 2017 01:16

    mwpastore on v1.3.0

    (compare)

  • Oct 27 2017 01:16

    mwpastore on master

    Bump to 1.3.0 (compare)

  • Oct 27 2017 01:10

    mwpastore on master

    Deprecate `sinja {}' in favor o… Make sure Rubygems is up-to-dat… Dynamic before_<action> arity and 5 more (compare)

  • Oct 06 2017 04:30
    mwpastore commented #16
  • Oct 06 2017 00:39
    jnylen closed #16
  • Oct 06 2017 00:39
    jnylen commented #16
  • Oct 05 2017 22:19
    mwpastore commented #16
  • Oct 05 2017 22:14
    mwpastore commented #16
  • Oct 04 2017 00:02
    jnylen commented #16
  • Oct 03 2017 23:43
    jnylen commented #16
  • Oct 02 2017 19:49
    mwpastore commented #16
  • Sep 26 2017 21:34
    mwpastore commented #16
  • Sep 26 2017 14:29
    jnylen commented #16
  • Sep 26 2017 14:27
    jnylen commented #16
Lucas Hosseini
@beauby
Yeah, that :)
Mike Pastore
@mwpastore
looks good. the problem with your other attempt is that you should just return the collection from your action helper (serialize_models is called behind the scenes), along with a hash of options to pass to jsonapi-serializers. and you can't use return, you have to use next. so you wanted
index(roles: %i[user trusted]) do
  next Models::User.all, fields: { users: indexable_fields }
end
this is covered in the first paragraph of this section here https://github.com/mwpastore/sinja#action-helpers and several examples are scattered throughout the readme
but in general, yes, as Lucas points out I recommend using before_index (and before_show, etc.) to set defaults for query parameters like include, fields, sort, filter, page, etc.
Jonathan Gnagy
@jgnagy
thanks, and I'll keep that in mind going forward
I've enjoyed using Sinja, by the way... it has really made creating my API easier
keep up the great work!
Mike Pastore
@mwpastore
that's great to hear
thank you :)
Jonathan Gnagy
@jgnagy
if you care to see the service I've been hacking on that uses it: https://github.com/knuedge/authify-api
Mike Pastore
@mwpastore
it's clumsy in lots of places and looking back on it there's a lot I'd like to revisit but on the whole I'm happy with the type of application development it enables
sweet
Lucas Hosseini
@beauby
Hey @mwpastore, FYI, I started building a compliance-testing tool for jsonapi serialization libraries (https://github.com/beauby/jsonapi-grader, see description here: https://github.com/json-api/json-api/pull/1203#issuecomment-319733112 )
Mike Pastore
@mwpastore
@beauby oh, that's really exciting! is there going to be a description of the resource endpoints that must be implemented to pass the test suite?
Lucas Hosseini
@beauby
@mwpastore So for now I decided to do it on a lower level, and simply provide fixed jsonapi documents that each implementation would have to provide a way to generate
So it doesn’t really concern Sinja or higher-level frameworks
Mike Pastore
@mwpastore
ah so it's testing serialization formats more than anything
Lucas Hosseini
@beauby
But I’m planning to work on an HTTP compliance test suite as well
Mike Pastore
@mwpastore
that would be really cool
Lucas Hosseini
@beauby

ah so it's testing serialization formats more than anything

Yup

Mike Pastore
@mwpastore
I see you're writing it in Ruby, let me know if I can be of any assistance
unfortunately the Ruby json:api clients are kind of terrible
Lucas Hosseini
@beauby
Cool! At the moment, the main thing lacking is more scenarii
Mike Pastore
@mwpastore
I started trying to fix up Munson to use in Sinja's test suite and it was a complete disaster
Lucas Hosseini
@beauby
Yeah ruby clients suck – I started working on one but got busy with other stuff
Mike Pastore
@mwpastore
if you do eventually expand to http testing I wonder if it wouldn't make more sense to use something like Ember Data
Lucas Hosseini
@beauby
I think the form the HTTP test suite will take is mainly a bunch of scenarii each of which will be composed of fixed HTTP requests, and a way to grade the response
Mike Pastore
@mwpastore
yes that makes sense, with this verb, these headers, and this path, it should return this response code and payload
Lucas Hosseini
@beauby
Hmm not sure, as actually we would mainly do ad-hoc inspection of the response payloads
Mike Pastore
@mwpastore
that's fair
now that I think about ember data is actually kind of too forgiving when it comes to deserialization
Lucas Hosseini
@beauby
Yeah that’s what I’m afraid of
The way I envision things, each test scenario would first fire-up a fresh server (how to do that would be the implementers’ responsibility), then execute the request-response cycles, and kill the server before passing to the next test-case
That way, we could easily make some assumptions like “if I create an article, it will be the first, so the id will be 1
Lucas Hosseini
@beauby
Maybe we should start with a single integration test, along the lines of:
  • GET /articles
  • POST /articles
  • GET /articles
  • GET /articles/1
  • GET /articles/1/comments
  • POST /articles/1/comments
  • POST /articles/1/comments
  • GET /articles/1/comments
  • GET /articles/1
  • DELETE /comments/1
  • GET /articles/1
  • PATCH /articles/1
  • GET /articles/1
  • DELETE /articles/1
My mind is not fully clear on the whole thing yet, but if you’d like we could work on it together (probably somewhere else to avoid polluting this channel)
Lucas Hosseini
@beauby
@mwpastore FYI: json-api/json-api#1209
Marwan Rabbâa
@waghanza
hello
how can we defined included with sinja ?
(I've found any doc)
Mike Pastore
@mwpastore
Hi @waghanza! I'm not sure I understand the question. What are you trying to do?
Marwan Rabbâa
@waghanza
Hi @mwpastore , I'm trying to define a route (GET) that understand include
For example, routes
/products?include=price
/products
Mike Pastore
@mwpastore
The include query parameter is automatically passed to the object serializer
so if you define your action helpers following the readme you shouldn't ever have to worry about include
Marwan Rabbâa
@waghanza
Hi
Marwan Rabbâa
@waghanza
When defining graft for my has_many relationships, I have
NoMethodError: undefined method `graft' for Api:Class
Marwan Rabbâa
@waghanza
I've found a solution (using sinja-sequel)
Mike Pastore
@mwpastore
Hrrm, it looks like you didn't register the extension in your module
But yes, if you're using Sequel, sinja-sequel is great