asyncapi / python-paho-template

Python Paho template for the AsyncAPI generator
Apache License 2.0
26 stars 25 forks source link

Handler the list, nested object and required properties #195

Open tornabene opened 11 months ago

tornabene commented 11 months ago

Reason/Context

Handler the list, nested object and required properties

Description

Please try answering few of those questions

github-actions[bot] commented 11 months ago

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

tornabene commented 11 months ago

This is the exampe

S3Data: type: object additionalProperties: readOnly: true writeOnly: false uniqueItems: false required:

from fileS3Temp import FileS3Temp

class FileS3Event(Entity):

class S3Data(Entity):

    def __init__(
            self,
            s3Bucket: str,
            s3Key: str):
        self.s3Bucket = s3Bucket
        self.s3Key = s3Key

class Attribute(Entity):

    class EventType(str, Enum):
        CAR = 'CAR'
        CONTENT = 'CONTENT'
        UNRECOGNIZED = 'UNRECOGNIZED'

    def __init__(
            self,
            eventType: EventType,
            resourceId: str,
            companyId: str,
            clientId: str,
            userId: str,
            username: str,
            filename: str,
            eventId: str,
            parentId: str):
        self.eventType = eventType
        self.resourceId = resourceId
        self.companyId = companyId
        self.clientId = clientId
        self.userId = userId
        self.username = username
        self.filename = filename
        self.eventId = eventId
        self.parentId = parentId

class EventType(str, Enum):
    CAR = 'CAR'
    CONTENT = 'CONTENT'
    UNRECOGNIZED = 'UNRECOGNIZED'

class ClassifiedType(str, Enum):
    PDF = 'PDF'
    PDF_EMBEDDED_JPG = 'PDF_EMBEDDED_JPG'
    IMAGE_JPG = 'IMAGE_JPG'
    IMAGE_JPG_TEXT = 'IMAGE_JPG_TEXT'
    IMAGE_PNG = 'IMAGE_PNG'
    IMAGE_PNG_TEXT = 'IMAGE_PNG_TEXT'
    NOT_SUPPORT = 'NOT_SUPPORT'

class ResourceStatus(str, Enum):
    PREURL = 'PREURL'
    UPLOAD = 'UPLOAD'
    COPY_S3 = 'COPY_S3'
    CLASSIFIED = 'CLASSIFIED'
    VERIFICATIONS_PENDING = 'VERIFICATIONS_PENDING'
    VERIFICATIONS_COMPLETE = 'VERIFICATIONS_COMPLETE'
    ERROR = 'ERROR'

class PdfImagesExtracted(Entity):

    def __init__(
            self,
            s3Bucket: str,
            s3Key: str,
            filename: str,
            sha512: str):
        self.s3Bucket = s3Bucket
        self.s3Key = s3Key
        self.filename = filename
        self.sha512 = sha512

def __init__(
        self,
        s3Data: S3Data,
        attribute: Attribute,
        eventType: EventType,
        contentType: str,
        classifiedType: ClassifiedType,
        eventId: str,
        errorMessage: str,
        resourceStatus: ResourceStatus,
        pdfImagesExtracted: Sequence[PdfImagesExtracted],
        parentResources: Sequence[str]):
    self.s3Data = s3Data
    self.attribute = attribute
    self.eventType = eventType
    self.contentType = contentType
    self.classifiedType = classifiedType
    self.eventId = eventId
    self.errorMessage = errorMessage
    self.resourceStatus = resourceStatus
    self.pdfImagesExtracted = pdfImagesExtracted
    self.parentResources = parentResources

this properties are not required self.classifiedType = classifiedType self.eventId = eventId self.errorMessage = errorMessage self.resourceStatus = resourceStatus self.pdfImagesExtracted = pdfImagesExtracted self.parentResources = parentResources

the selft.s3Data nested is not type S3Data

the seft.pdfImagesExtracted the item is not type PdfImagesExtracted

so i want add some new part

tornabene commented 11 months ago

I will push the solution here https://github.com/tornabene/python-template

ag asyncapi.yaml @tornabene.org/python-paho-template@0.2.15 -o python