jakubrohleder / angular-jsonapi

Simple and lightweight, yet powerful ORM for your frontend that seamlessly integrates with your JsonAPI server.
http://jakubrohleder.github.io/angular-jsonapi/
GNU General Public License v3.0
95 stars 34 forks source link

Write documentation #1

Closed jsenecal closed 8 years ago

jsenecal commented 9 years ago

You seem to have a great project going on and it would be nice to have a description of what it can do if possible :)

Is it currently in a working state? Can the library be used in my projects as well? So many questions!

jakubrohleder commented 9 years ago

Sorry I haven't notice your post earlier, but thanks for asking.!

This library is created along with my rails project and is currently in the WIP state. Nevertheless most of functionalities are working correctly and surely can be used in projects right now, but since it haven't got any test, some bugs might still occur.

Your issue gave me a motivational boost and I'll prepare some basic documentation and refactor the example, so it reflects the current project state, by the weekend.

jsenecal commented 9 years ago

Well what you are trying to achieve is, so far something no-one else did, that is, supporting the JSON:API spec natively in AngularJS - I've been mostly hacking my way through with restangular but if you have something that just works I would gladly contribute :)

jakubrohleder commented 9 years ago

Sorry for the late response, I've had a lot of work with other projects recently and didn't manage to prepare documentation by the weekend. Unfortunately I'm leaving the country today for a week of vacation, but as soon as i get back I'll finish the demo and documentation.

My approach is a bit more complex then just parsing JSON:API. What i wanted to achieve is a flexible object oriented structure which not only communicates with REST service but also enables easy local store caching and, in the future, building semi-offline apps (that synchronise with the server when it is possible).

Another boring angular issue I wanted to tackle, is to provide, based on the resource schema, flexible validation methods to make resource form easy to build.

Hope you like this approach!

jsenecal commented 9 years ago

I see that you are actively developing on this - What are you using as backend?

Our backend returns information related to the current endpoint with the OPTIONS http method like so:

{
    "name": "User Instance",
    "description": "API endpoint that allows users to be viewed or edited.",
    "renders": [
        "application/json",
        "application/vnd.api+json",
        "text/html"
    ],
    "parses": [
        "application/json",
        "application/vnd.api+json",
        "application/x-www-form-urlencoded",
        "multipart/form-data"
    ],
    "actions": {
        "PUT": {
            "id": {
                "type": "integer",
                "required": false,
                "read_only": true,
                "label": "ID"
            },
            "last_login": {
                "type": "datetime",
                "required": false,
                "read_only": false,
                "label": "Last login"
            },
            "is_superuser": {
                "type": "boolean",
                "required": false,
                "read_only": false,
                "label": "Superuser status",
                "help_text": "Designates that this user has all permissions without explicitly assigning them."
            },
            "username": {
                "type": "string",
                "required": true,
                "read_only": false,
                "label": "Username",
                "help_text": "Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.",
                "max_length": 30
            },
            "first_name": {
                "type": "string",
                "required": false,
                "read_only": false,
                "label": "First name",
                "max_length": 30
            },
            "last_name": {
                "type": "string",
                "required": false,
                "read_only": false,
                "label": "Last name",
                "max_length": 30
            },
            "email": {
                "type": "email",
                "required": false,
                "read_only": false,
                "label": "Email address",
                "max_length": 254
            },
            "is_staff": {
                "type": "boolean",
                "required": false,
                "read_only": false,
                "label": "Staff status",
                "help_text": "Designates whether the user can log into this admin site."
            },
            "is_active": {
                "type": "boolean",
                "required": false,
                "read_only": false,
                "label": "Active",
                "help_text": "Designates whether this user should be treated as active. Unselect this instead of deleting accounts."
            },
            "date_joined": {
                "type": "datetime",
                "required": false,
                "read_only": false,
                "label": "Date joined"
            }
        }
    }
}

Is that something that was in your mind?

jakubrohleder commented 9 years ago

I'm currently using Ruby on Rails server with jsonapi-resources gem. To be true I haven't thought about using OPTION request as a way of setting API schema, but as at a first glance it seems to be quite a good idea and I'll think about adding this option later.

Currently data schema has to be hardcoded into your application (with attributes, relationships and validation methods).

Technically I'm still on holiday, that's why the development of docs is a bit slow.

jakubrohleder commented 8 years ago

@jsenecal two days ago i just released version 1.0.0-alpha, so if you are still interested have a look a the fully functional demo. Most of the code had been rewritten to be more testable, and ease to read and use. Things that does not work yet but will be fixed are: filters and validators (all data passes validation, I'm working on making this module optional and with http://validatejs.org/ integration in it).

If you want you want to test demo with your own server just download and change models in demo/app/factories directory and names array in demo/index.js:18 to reflect you schema.

I've also noticed you forked the repo, so I recommend updating it to the current state.

jsenecal commented 8 years ago

thanks @jakubrohleder, we went with our own thing for now as we needed things going quickly but i'll keep an eye on this project :)

dhyegocalota commented 8 years ago

I'll keep an eye too. That's an awesome project. Nice job.

If you provider some clear information about your roadmap (like opening issues), I could start to better understand and give you some help. Is that possible?

jakubrohleder commented 8 years ago

Thanks! Currently I'm getting all of my ideas and work together to provide consistent API, documentation and the demo that actually explains anything. I will be then much easier for you to deal with the code and the project itself. I'm pretty advanced with this and hope to release the alpha.2 by the end of the week.

Afterwards I'd love to ask you for collaboration, both conceptual and with development.

My main idea, when I was starting the project, was to create something that helps me deal with the data relationships/synchronization/validation stuff in the most pleasant and minimalistic way. I'd awesome to hear opinions of the others and make this project work for everyone.

jakubrohleder commented 8 years ago

@dhyegofernando I finally managed to finish 1.0.0-alpha.2 release. Finally readme covers all topics (but still it needs some work) and roadmap is getting more clear.

As you can see I want to add multiple minor tweaks for 1.0.0-alpha.3, afterwards the project will be completed and 100% useable. The next stages will be more community-driven and will focus on testing as well as adding features / improvements that you find important.

As the documentation is nearly completed I'll close this issue and open new: for Q&A and improvements discussion.

dhyegocalota commented 8 years ago

Nice done @jakubrohleder.