Giter Site home page Giter Site logo

Comments (9)

christopherstyles avatar christopherstyles commented on July 19, 2024 1

After much scratching-of-the-head over some really odd behavior (data structures with child attributes displaying as siblings, disappearing sections, etc) when using 2-space indentation, I think we should make it a general rule to indent all things with 4 spaces. Itโ€™s how they format indents in their examples. Switching to 4-space indentation led to much more predictable behavior.

from deprecated-code-corps-rails-api.

joshsmith avatar joshsmith commented on July 19, 2024

It would be good to clarify where in the API spec you're sourcing the conventions, and also to look through our existing blueprint to see what other types of objects we're missing from your example that would be renamed.

This process won't catch every edge case right now, but we at least have a good pool of real-world examples from our own project to discuss in the course of this conversation.

from deprecated-code-corps-rails-api.

green-arrow avatar green-arrow commented on July 19, 2024

@joshsmith what do you mean by clarify where in the API spec I'm sourcing the conventions? Like where did I come up with the convention?

In that case, the double spacing came from #458.

As for other types of objects, the kinds I'm seeing are:

Errors (conflict, 4xx errors like not found, etc)
OAuth Grant

Maybe it would be good to separate out the resource data structures from these other more generic structures?

from deprecated-code-corps-rails-api.

christopherstyles avatar christopherstyles commented on July 19, 2024

A little late to the conversation, but I love where this is going. Good call on mirroring json-api, makes a lot of sense ๐Ÿ‘

from deprecated-code-corps-rails-api.

begedin avatar begedin commented on July 19, 2024

๐Ÿ‘ For me as well. I wen't a bit overboard with objects in my PR. This is a nice balance and the naming is clear.

The only trouble I'm seeing (and I'm having that in my PR as well, are "reduced" objects we use in requests. For example, in a POST request, our Comment Resource

  • does not have an ID
  • it only supports and requires the "markdown" attribute. Nothing else can be assigned by the user. If we add more attributes, the API wont fail, but those will be ignored
  • it only supports and requires the post relationship. user relationship is ignored and assigned as current user API-side, as are comment user mentions

Any ideas on how we might be able to handle that in a nice way? I guess if there's little repetition of cases like that, we can just create them individually for now.

from deprecated-code-corps-rails-api.

christopherstyles avatar christopherstyles commented on July 19, 2024

In case anyone else comes across this: if you have an attribute with an underscore _ and its value also has an underscore _, the example text wonโ€™t render correctly in the UI. Hereโ€™s an example:

+ state_transition: `signed_up` (string, optional)

The output will look something like this:

image

Instead, you have to escape the attribute name with backticks, like this:

+ `state_transition`: `signed_up` (string, optional)

โ€ฆso that it renders properly:

image

This was discussed in apiaryio/api-blueprint#224 (comment)

from deprecated-code-corps-rails-api.

joshsmith avatar joshsmith commented on July 19, 2024

@begedin doesn't the comment resource have an id due to include Comment Resource Identifier?

from deprecated-code-corps-rails-api.

joshsmith avatar joshsmith commented on July 19, 2024

@begedin I think we handle individually now at cost of repetition and break it down further if needed.

from deprecated-code-corps-rails-api.

joshsmith avatar joshsmith commented on July 19, 2024

Does someone want to take on adding documentation for this in a pull request, or possibly just adding this to the wiki to save some time?

from deprecated-code-corps-rails-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.