Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dealing with xsd:anyType #180

Closed
dyron opened this issue Jan 31, 2025 · 3 comments
Closed

Dealing with xsd:anyType #180

dyron opened this issue Jan 31, 2025 · 3 comments

Comments

@dyron
Copy link

dyron commented Jan 31, 2025

From the README:

If your XSD contains xsd:anyType or xsd:anySimpleType types you have to specify a handler for this.

When you generate the JMS metadata you have to specify a custom handler:

# config.yml

xsd2php:
  ...
  aliases: 
    'http://itzbund.de/ozg/bzst/post/dip/v1/':
      anyType: 'MyCustomAnyTypeHandler'

But doing so produces

In ScalarNode.php line 36:
                                                                                                                        
  Invalid type for path "xsd2php.aliases.http://itzbund.de/ozg/bzst/post/dip/v1/". Expected "scalar", but got "array".  

How could this be fixed?

@goetas
Copy link
Member

goetas commented Feb 1, 2025

which version of symfony/config have you installed? could you post the whole stack trace?

@dyron
Copy link
Author

dyron commented Feb 7, 2025

The symfony/config version is v7.2.3.

ScalarNode.php:33, Symfony\Component\Config\Definition\ScalarNode->validateType()
BaseNode.php:487, Symfony\Component\Config\Definition\BaseNode->doValidateType()
BaseNode.php:354, Symfony\Component\Config\Definition\BaseNode->normalize()
PrototypedArrayNode.php:237, Symfony\Component\Config\Definition\PrototypedArrayNode->normalizeValue()
BaseNode.php:357, Symfony\Component\Config\Definition\BaseNode->normalize()
ArrayNode.php:269, Symfony\Component\Config\Definition\ArrayNode->normalizeValue()
BaseNode.php:357, Symfony\Component\Config\Definition\BaseNode->normalize()
Processor.php:32, Symfony\Component\Config\Definition\Processor->process()
Processor.php:46, Symfony\Component\Config\Definition\Processor->processConfiguration()
Extension.php:109, Symfony\Component\DependencyInjection\Extension\Extension->processConfiguration()
Xsd2PhpExtension.php:18, GoetasWebservices\Xsd\XsdToPhp\DependencyInjection\Xsd2PhpExtension->load()
MergeExtensionConfigurationPass.php:81, Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass->process()
Compiler.php:73, Symfony\Component\DependencyInjection\Compiler\Compiler->compile()
ContainerBuilder.php:814, Symfony\Component\DependencyInjection\ContainerBuilder->compile()
Convert.php:80, GoetasWebservices\Xsd\XsdToPhp\Command\Convert->loadConfigurations()
Convert.php:47, GoetasWebservices\Xsd\XsdToPhp\Command\Convert->execute()
Command.php:279, Symfony\Component\Console\Command\Command->run()
Application.php:1076, Symfony\Component\Console\Application->doRunCommand()
Application.php:342, Symfony\Component\Console\Application->doRun()
Application.php:193, Symfony\Component\Console\Application->run()
xsd2php:26, include()
xsd2php:119, {main}()

@dyron
Copy link
Author

dyron commented Feb 8, 2025

My bad I have used the branch from #177 which may cause the error:

https://github.com/goetas-webservices/xsd2php/pull/177/files#diff-ebe00144d6cecb5ca8a2860883e01147f42bbed2b12a3a7f44915908a4829faaR69

It worked with the 0.4.13 tag.

And for the record it has to be

# config.yml

xsd2php:
  ...
  aliases: 
    'http://www.w3.org/2001/XMLSchema':
      anyType: 'MyCustomAnyTypeHandler'

since http://itzbund.de/ozg/bzst/post/dip/v1/ doesn't define anyType itself.

@dyron dyron closed this as completed Feb 8, 2025
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

No branches or pull requests

2 participants