Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Apr 13 14:08
    hugopeixoto commented #20
  • Nov 03 2021 16:38
    epergo closed #21
  • Oct 02 2021 12:42
    epergo edited #21
  • Oct 02 2021 12:33
    epergo edited #21
  • Oct 02 2021 12:31
    epergo edited #21
  • Oct 02 2021 11:54
    epergo synchronize #21
  • Oct 02 2021 11:50
    epergo opened #21
  • Sep 27 2021 08:52
    olofheurgren commented #20
  • Sep 24 2021 14:46
    mwpastore pinned #20
  • Sep 24 2021 09:43
    olofheurgren edited #20
  • Sep 24 2021 09:41
    olofheurgren edited #20
  • Sep 24 2021 09:39
    olofheurgren edited #20
  • Sep 24 2021 09:36
    olofheurgren opened #20
  • Jan 08 2020 17:21
    mwpastore commented #19
  • Dec 22 2019 18:07
    senid231 edited #19
  • Dec 22 2019 17:57
    senid231 commented #19
  • Dec 22 2019 17:56
    senid231 opened #19
  • Feb 11 2019 22:55

    mwpastore on namespace-dsl

    wip (compare)

  • Sep 08 2018 13:00
    jnylen closed #17
  • Feb 24 2018 10:59
    jannishuebl commented #18
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
Jason Crockett
@adisciple50
hello sinja ninjas! right now im just getting started. ive specified a find helper but it allways comes up nill. can you help me?
Mike Pastore
@mwpastore
adisciple50: Hi there, can you share some code?
preferably through a gist or gitweb link
ahmad Abd AlRaheem
@Ahmad3M3_twitter
Does anyone know if it's possible to do such a thing in sinja or not?
Jonathan Gnagy
@jgnagy
I noticed that sinja is producing links with relative paths, which I suppose is OK if it takes into account reverse proxies that alter the URI path. If I'm running a Sinatra app behind an API gateway like Kong that has it as /myapp, which goes to an upstream at / (meaning I hit https://gateway/myapp/foo and Sinatra sees just /foo) how can I make sinja generate the right URI paths?
maybe some way to prepend a URI path based on some config somewhere?
possibly related: If I try mounting my app at the same URI path via run Rack::URLMap.new '/myapp' => MySinjaApp.new, the links generated for my resources still don't show /myapp anywhere
Jonathan Gnagy
@jgnagy
This might just be a serializer-specific question... I'm going to experiment with def base_url in the Serializer and see if that solves my problem... I can probably just make that an environment variable, though ideally I'd find a way to do that based on the request
Hugo Peixoto
@hugopeixoto
:wave: I have a ember app talking to a sinja backend, and things were working OK (after some tweaking to make this work with ruby 3), but as soon as I added a header to the ember adapter, sinja started complaining that include query parameter not allowed in the preflight request for GET /bags?include=bag-cards. Having some trouble debugging this, anyone has any clues? This happens in the getter for qparams, app.set :qparams do |*allow_params|, where allow_params is empty if I send a header. I guess this means it's matching a different route when the header is present vs when it's not?
Hugo Peixoto
@hugopeixoto

After some investigation, the addition of the header triggers a CORS preflight request (since it's no longer a "simple request"). Looking randomly at resource_routes.rb,

app.options '' do
  allow :get=>:index, :post=>:create
end

app.get '', :qparams=>%i[include fields filter sort page], :actions=>:index do
   etc
end

it seems that the options routes don't have the qparams parameter. After adding the qparams thing to app.options (copying it from app.get), it seems to work. Does this fix make sense, or am I getting this wrong? Shall I make a PR adding qparams to the app.options entries?