Skip to content

0.2 release#34

Draft
jumblesale wants to merge 11 commits intomasterfrom
0.2
Draft

0.2 release#34
jumblesale wants to merge 11 commits intomasterfrom
0.2

Conversation

@jumblesale
Copy link
Owner

a holding PR for everything included in the 0.2 release

@cgearing
Copy link
Collaborator

Great ideas. I like the idea of pulling the logic out of the resources. Would the intention be to handle the API paths in a similar way?

@jumblesale
Copy link
Owner Author

yeah, we could definitely handle the api paths similarly, there's not too much logic in there right now so it should be easy to pull it out into a separate method I think?


it is proposed that this code moves into a library function which then
gets imported by the endpoint. this will make the code easier to test,
and will result in a smaller generated codebase.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it. It would allow people to be much more granular about which bits of the Genyrator they use.

gets imported by the endpoint. this will make the code easier to test,
and will result in a smaller generated codebase.

### validation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds lovely, in practice we've seen this being a huge problem in day to day use.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, I massively typoed in there. In practice we've not seen this being a huge problem in day to day use. I think it would be nice, I'm not sure it's the highest priority for us.

error reporting should be as approachable and helpful as possible. see
[elm](https://elm-lang.org/) for inspiration.

### declarative entity definitions
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is hard to get right. There is a lot of additional information involved in putting together a a set of entities and decorator based interfaces are notoriously hard to get right, particularly if they're dealing with a lot of data.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think this would be a much nicer interface than the current declarative approach. with the decorators I only mean for collecting the classes - the alternative to this is doing it in the SQLAlchemy style which I think is a lot less pleasant. would be fun to spike this out to see how it looks

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe I need to see it. It would be nice if it could be implemented initially as an additional interface that produces the current interface. That way it could introduced in a backwards compatible way.

[attr.s](http://www.attrs.org/en/stable/) to configure the behaviour of
entities.

### schema validation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would strongly encourage against implementing yet another validation engine. There are two (three if you count jsonschema) as part of genyrator already (marshmallow and flask-resplus). I think it would be better if figured out how to lean on one of those more.

Given that flask-restplus seems to be unmaintained now and marshmallow is widely used in the community my preference would be there. Even if it is a bit lacking.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, would be nice if we could do this with an existing framework 👍

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

marshmallow-sqlalchemy has support for overriding fields and for manually generating fields (that function accepts keyword arguments that are passed on down to the marshmallow field) so this does not sound very difficult.

to specify column-level validation - how would this look?


### callbacks
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be interesting to step back and think of different ways of approaching this. Are callbacks the right answer or being able to fully override certain aspects. What are the actual user needs that we have come across? What would be most natural to a developer that already knows flask-restplus / flask / sqlalchemy / marshmallow ...?

Copy link
Owner Author

@jumblesale jumblesale Mar 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had this in here more as a place to stick ideas. the idea was that if you just want to customise a specific endpoint, or do a little more processing on all GETs or something like that, you could sneak your own code in.

@robyoung-digital
Copy link
Collaborator

The ideas in the README sound good. By the amount of additional code that seems to be going on in this PR is the intention to implement everything in here and then do one massive merge? I would be very nervous about that.

What is plan for this branch?
What is the idea with regard to upgrade path for existing clients?

@jumblesale
Copy link
Owner Author

is the intention to implement everything in here and then do one massive merge?

my plan was to implement most of it, would be good to split out the file to show what is the minimum and focus on those things but I think validation (of payload and schema) and moving out the behaviours would be a really good first start. and then do one massive merge :)

What is the idea with regard to upgrade path for existing clients?

tbh my plan was to try to maintain backwards-compatibility but to break things where necessary. without access to a large existing implementation, I will have to rely on tests to see if it's going to break things.

@robyoung-digital
Copy link
Collaborator

I was thinking about how other projects manage change and wondered whether we could manage these features with issues and address each separately with PRs. That way we have an easy to navigate history of larger change items. It also allows us to make a feature by feature call about whether they can be implemented in a backwards compatible way (I think they all can).

In terms of how to manage those that can't. Could we, at the point that we are going to introduce a backwards compatibility breaking change cut a 0.1 branch off master? That way master would always be the most advanced branch. Bug fixes and non-backwards compatibility breaking changes could then be backported to the 0.1 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants