inossidabile/wash_out — pull request #125 by bogdanRada (2013-11-18 12:07:59+00:00)
Title: Generation of html documentation and using custom fault errors. 

I am not sure if this features help someone, but for me they were very useful and i thought maybe this might help somebody else also.

I added new route
match "#{controller_name}/doc" => "#{controller_name}#_generate_doc", :via => :get, :format => false

that will generate html documentation in a very human readable way. i actually was impressed by the documentation that PHP WSDL Creator http://code.google.com/p/php-wsdl-creator/) was generating and i thought i will do something the same .

The only problem is since you could have a Washout::Type like this:

class MyModel < WashOut::Type
map :project => {
:name => :string,
:description => :string,
:users => [{:mail => :string }],
:member => {:users => [{:some_fiedl=> :string}] }
}
end

I can determine the nested complex types( hashes in our case) but i don't have a name for them, So i use the key that references that complex type and add a timestamp to its name if i already detected a complex type with that name. Not sure if this is the best solution. but please let me know if you have some other suggestions

And i also added a new class Washout::SoapFault and posibilty to rescue from classes that inherit form this class. This class allow you to set a faultcode, faultstring and a array with possible errors that can be related to a object. This is very useful when you want to raise a soap fault from your webservice with a custom fault error code . ALso this class could be extended to contain other attributes and /or methods.

Also in the controller when specifying the soap action you can also pass a option "raises" with a list of exception classes that the method could raise at a given moment, and a option for description . This are useful for generating the html documentation.

Please let me know if you find any of this features useful . They might need some improvements and please let me know if you have some suggestions or if something needs modification.