Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

generator customization #619

Closed Unanswered
brunnels asked this question in Q&A
Nov 16, 2021 · 1 comments · 2 replies
Discussion options

I'm trying to add some customization for a really huge SOAP wsdl.

I've been looking at the xsdata-attr plugin and have been able to figure out quite a bit from there.

Now I want to parse the WSDL for comments on the <complexType name="Row"> that specify the fields that can be populated depending on which operation is called. I want to use those comments to get the available fields and then create a new dataclass named with 'operation_name_row.py` with and only the available fields.

I was looking through the codegen/handlers but I'm not sure how to utilize them in a custom subclass of DataclassGenerator. Am I on the right path or should I be trying to do something outside of the generator?

For an example this comment

 <!-- method:list_refreshtoken can return the following fields 
 refreshTokenID
 userID
 refreshToken
 createDate
 -->

would give me a file of list_refreshtoken.py with contents

from dataclasses import field, dataclass
from typing import Optional
__NAMESPACE__ = "http://microfocus.com/nas/2020/08"
@dataclass
class ListRefreshtokenRow:
 refresh_token_id: Optional[int] = field(
 default=None,
 metadata={
 "name": "refreshTokenID",
 "type": "Element",
 "namespace": "http://microfocus.com/nas/2020/08",
 "nillable": True,
 }
 )
 user_id: Optional[int] = field(
 default=None,
 metadata={
 "name": "userID",
 "type": "Element",
 "namespace": "http://microfocus.com/nas/2020/08",
 "nillable": True,
 }
 )
 refresh_token: Optional[str] = field(
 default=None,
 metadata={
 "name": "refreshToken",
 "type": "Element",
 "namespace": "http://microfocus.com/nas/2020/08",
 "nillable": True,
 }
 )
 create_date: Optional[str] = field(
 default=None,
 metadata={
 "name": "createDate",
 "type": "Element",
 "namespace": "http://microfocus.com/nas/2020/08",
 "nillable": True,
 }
 )
You must be logged in to vote

Replies: 1 comment 2 replies

Comment options

wow it took me 4 months to discover that there were discussions in the repo, this is resolved right @brunnels ?

You must be logged in to vote
2 replies
Comment options

I have issues open on the still pending things

Comment options

tefra Aug 6, 2022
Maintainer

As far as I know this issue is resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /