Skip to content

List of interface type #1990

@steeling

Description

@steeling

General Question

Let's say I want a schema with a list of generic types, like k8s objects:

import k8s.apimachinery.pkg.apis.meta.v1 as metav1
import k8s.api.apps.v1 as appsv1

schema Object: # Or protocol Protocol
    apiVersion: str
    kind: str
    metadata: metav1.ObjectMeta

schema MyList:
    manifests: [Object] = [
        appsv1.Deployment {}
    ]

out = MyList{}

I don't own the k8s.api.apps.v1 package, so I can't make the changes there. I've tried with protocols and mixins which don't work. Is there a way to support this? or do i need to rewrite each type myself and have them inherit from a base type, like schema MyDeployment(Object):....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions