laminas-api-tools / api-tools

Laminas API Tools module for Laminas
https://api-tools.getlaminas.org/documentation
BSD 3-Clause "New" or "Revised" License
37 stars 19 forks source link

DB-Connected REST service should create fields automatically from DB schema #71

Open michalbundyra opened 4 years ago

michalbundyra commented 4 years ago

Usually, DB-connected services are created on databases that already exist. So, the DB schema is already known and Apigility can automatically configure the DB columns as fields in the REST service. Apigility can also automatically configure some attributes of the fields, e.g. if the field is required, or create a validator that ensures an integer input, etc.

At the moment, after creating the DB-connected service, I have to edit it and add all these fields myself, which is error prone. I have to look at the DB schema and type the exact column names as field names.

This improvement will bring this RAD feature one step forward.


Originally posted by @kaloyan-raev at https://github.com/zfcampus/zf-apigility/issues/37

michalbundyra commented 4 years ago

I could not agree more... Hopefully, I've been working on this need and already made a PR that is to be implemented in version 1.1 in about a month. Basically, it's called "Database Autodiscovery". You'll get an extra-tab on the REST service creation screen. After choosing your adapter, DB Autodiscovery will introspect your DB schema and generate DB-connected services as well as fields, based on column definitions. It's for now stable and just need a bit of cleaning and unit testing. Stay tuned ;)


Originally posted by @jguittard at https://github.com/zfcampus/zf-apigility/issues/37#issuecomment-43068432

michalbundyra commented 4 years ago

Sounds great!


Originally posted by @kaloyan-raev at https://github.com/zfcampus/zf-apigility/issues/37#issuecomment-43068717

michalbundyra commented 4 years ago

@kaloyan-raev You can see the work @jguittard has done in zfcampus/zf-apigility-admin#179


Originally posted by @weierophinney at https://github.com/zfcampus/zf-apigility/issues/37#issuecomment-49086770