[katello-devel] Foreman-api

Chris Alfonso calfonso at redhat.com
Mon Aug 27 13:54:25 UTC 2012


On 27/08/12 14:15 +0200, Lukas Zapletal wrote:
>On Mon, Aug 27, 2012 at 01:07:14PM +0200, Miroslav Suchy wrote:
>> On 08/27/2012 11:27 AM, Ivan Nečas wrote:
>> >Me as a developer, I find it much easier to use the code that I
>> >immediately see what it expects from me.
>> >
>> >[1] -
>> >https://github.com/calfonso/deadwood/blob/master/lib/deadwood/model/environment.rb
>> >
>> >[2] -
>> >https://github.com/mbacovsky/foreman_api/blob/master/lib/foreman_api/resources/architecture.rb
>> >
>>
>> +1
>> [2] is much more readable to me.
>
>+1 No more "dynamic" stuff please.
>
>Plus your favourite IDE can OmniComplete :-)
>
>-- 
>Later,
>
Would you guys be interested in auto generating a katello api client gem?  It
would be really nice to be able to keep the client in sync with the server
api without having to really study the api changes.  Also, it would be really
nice to generate tests to go along with the rest client classes.

Regarding the deadwood attribute removal ambiguity comments, I think you guys
are comparing apples to oranges.  The consuming application that uses a
client will either want to interact with model objects and pass them around
in a client api, or they will be happy with passing around descriptive
hashes. In the case of the model object pattern, the developer should never
have to see the client api implementation, I just remove the attributeds that
aren't allowed to be updated[1]. If I pass a hash representation of a domain
[3], I can see by looking at the forman api code implementation which
attributes will be sent to foreman, but I still have to look at the forman
api documentation to understand what all attributes are avaialable on a
domain model and what values are acceptable and why I wasn't able to send
every domain attribute in an update api call (why is it a subset?).

Don't get me wrong here, anytime you have server side attribute validation
the client will want to know what attributes are being validated and why.
Right now the only way to find out what model attributes in Katello that are
not allowed in an update is by submiting a request and watching a traceback
appear in the server logs.  Personally, I think this is a documentaiton task
TODO. I don't expect developers to go read the Katello controller
implementation to discover what type of validation has to happen, just as I
don't expect api gem consumers to have to read the api gem implemenation to
read what attributes are not allowed.

As a TODO for me, I'll add the documentation to the deadwood api for now to
describe the model attributes (allowed, not allowed, values, etc).

-- Chris
> Lukas "lzap" Zapletal
> #katello #systemengine
>
>_______________________________________________
>katello-devel mailing list
>katello-devel at redhat.com
>https://www.redhat.com/mailman/listinfo/katello-devel
[3]https://github.com/mbacovsky/foreman_api/blob/master/lib/foreman_api/resources/domain.rb
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/katello-devel/attachments/20120827/4b5d7492/attachment.sig>


More information about the katello-devel mailing list