ZF-10274: Add annotation-documentation element to wsdl complextype element
Description
I need some special features for my project.
I think it's possible to have documentation for each elements as
comment
I don't know if it is a really correct structure for wsdl.
And if type of element is declare as
class IdentiteType {
/** @var string $siren comment */
public $siren;
/** @var int */
public $id;
/** @var boolean */
public $forceVerif;
}
I modify Zend_Soap_Wsdl_Strategy_DefaultComplexType (line 73) and add this code
if ( preg_match('/@var\s+([^\s]+)\s+(\$[^\s]+\s)?(.+)\*/', $property->getDocComment(), $comment) ){
$annotation = $dom->createElement('xsd:annotation');
$documentation = $dom->createElement('xsd:documentation', $comment[3]);
$annotation->appendChild($documentation);
$element->appendChild($annotation);
}
Other code could be better ....
Comments
Posted by Michael Ricois (oxomichael) on 2010-08-06T07:51:29.000+0000
Format xml code
Posted by Michael Ricois (oxomichael) on 2010-09-06T05:49:08.000+0000
class IdentiteType { /** * Comment * @var string */ public $siren; /** @var int */ public $id; /** @var boolean */ public $forceVerif; }I change code to respect docBlock rules
$docBlock = preg_replace('/\n/', '', $property->getDocComment() ); if (preg_match('/\/\*\*(.+) \* @var\s+[^\s]+/m', $docBlock, $docBlockMatches)) { //Suppression tabulation et autres $comment = preg_replace( array('/\r/','/\t\s\*/'), array('',''), $docBlockMatches[1] ); // Ajout des éléments de documentation au WSDL $annotation = $dom->createElement('xsd:annotation'); $documentation = $dom->createElement('xsd:documentation', $comment); $annotation->appendChild($documentation); $element->appendChild($annotation); }