devfile / api

Kube-native API for cloud development workspaces specification
Apache License 2.0
257 stars 62 forks source link

constant values are missing in generated parent override and plugin override pkgs #538

Open yangcao77 opened 3 years ago

yangcao77 commented 3 years ago

/kind bug

Which area this bug is related to?

/area api

Bug Summary

Describe the bug:

all constants values are missing in the generated parent override & plugin override pkgs for example, endpoint protocols are defined as type EndpointProtocol with accepted values defined: https://github.com/devfile/api/blob/f78ab9de1a30ab6e7ebc16cbd570b3a65a3a407b/pkg/apis/workspaces/v1alpha2/endpoint.go#L10-L29

but in parent/plugin override pkgs, EndpointProtocolParentOverride has been generated, but those constants are missing: https://github.com/devfile/api/blob/f78ab9de1a30ab6e7ebc16cbd570b3a65a3a407b/pkg/apis/workspaces/v1alpha2/zz_generated.parent_overrides.go#L597

Expected behavior

those constants are expected to be in the generated override pkgs. For instance,

const (
    // Endpoint will have `http` traffic, typically on a TCP connection.
    // It will be automaticaly promoted to `https` when the `secure` field is set to `true`
    HTTPEndpointProtocolParentOverride EndpointProtocolParentOverride = "http"
    // Endpoint will have `https` traffic, typically on a TCP connection
    HTTPSEndpointProtocolParentOverride EndpointProtocolParentOverride = "https"
    // Endpoint will have `ws` traffic, typically on a TCP connection
    // It will be automaticaly promoted to `wss` when the `secure` field is set to `true`
    WSEndpointProtocolParentOverride EndpointProtocolParentOverride = "ws"
    // Endpoint will have `wss` traffic, typically on a TCP connection
    WSSEndpointProtocolParentOverride EndpointProtocolParentOverride = "wss"
    // Endpoint will have traffic on a TCP connection,
    // without specifying an application protocol
    TCPEndpointProtocolParentOverride EndpointProtocolParentOverride = "tcp"
    // Endpoint will have traffic on an UDP connection,
    // without specifying an application protocol
    UDPEndpointProtocolParentOverride EndpointProtocolParentOverride = "udp"
)

Any logs, error output, screenshots etc? Provide the devfile that sees this bug, if applicable.

N/A

Additional context

Any workaround?

since those constants are string. can specify the string value directly, e.g. "http", "https".

Suggestion on how to fix the bug

Roughly scanned through the code, need to edit the override/gen.go, since it only checks for Type's, so Const's are skipped. https://github.com/devfile/api/blob/f78ab9de1a30ab6e7ebc16cbd570b3a65a3a407b/generator/overrides/gen.go#L84

github-actions[bot] commented 2 months ago

This issue is stale because it has been open for 90 days with no activity. Remove stale label or comment or this will be closed in 60 days.

yangcao77 commented 2 months ago

still an issue