You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
components:
schemas:
AccessContextManagerAccessLevel:
properties:
apiVersion:
description: 'apiVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'type: stringkind:
description: 'kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'type: stringmetadata:
type: V1ObjectMetaspec:
properties:
accessPolicyRef:
description: |- The AccessContextManagerAccessPolicy this AccessContextManagerAccessLevel lives in.oneOf:
- not:
required:
- externalrequired:
- name
- not:
anyOf:
- required:
- name
- required:
- namespacerequired:
- externalproperties:
external:
description: 'Allowed value: string of the format `accessPolicies/{{value}}`, where {{value}} is the `name` field of an `AccessContextManagerAccessPolicy` resource.'type: stringname:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'type: stringnamespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'type: stringtype: objectbasic:
description: A set of predefined conditions for the access level anda combining function.properties:
combiningFunction:
description: |- How the conditions list should be combined to determine if a request is granted this AccessLevel. If AND is used, each Condition in conditions must be satisfied for the AccessLevel to be applied. If OR is used, at least one Condition in conditions must be satisfied for the AccessLevel to be applied. Default value: "AND" Possible values: ["AND", "OR"].type: stringconditions:
description: A set of requirements for the AccessLevel to be granted.items:
properties:
devicePolicy:
description: |- Device specific restrictions, all restrictions must hold for the Condition to be true. If not specified, all devices are allowed.properties:
allowedDeviceManagementLevels:
description: |- A list of allowed device management levels. An empty list allows all management levels. Possible values: ["MANAGEMENT_UNSPECIFIED", "NONE", "BASIC", "COMPLETE"].items:
type: stringtype: arrayallowedEncryptionStatuses:
description: |- A list of allowed encryptions statuses. An empty list allows all statuses. Possible values: ["ENCRYPTION_UNSPECIFIED", "ENCRYPTION_UNSUPPORTED", "UNENCRYPTED", "ENCRYPTED"].items:
type: stringtype: arrayosConstraints:
description: |- A list of allowed OS versions. An empty list allows all types and all versions.items:
properties:
minimumVersion:
description: |- The minimum allowed OS version. If not set, any version of this OS satisfies the constraint. Format: "major.minor.patch" such as "10.5.301", "9.2.1".type: stringosType:
description: 'The operating system type of the device. Possible values: ["OS_UNSPECIFIED", "DESKTOP_MAC", "DESKTOP_WINDOWS", "DESKTOP_LINUX", "DESKTOP_CHROME_OS", "ANDROID", "IOS"].'type: stringrequireVerifiedChromeOs:
description: If you specify DESKTOP_CHROME_OS forosType, you can optionally include requireVerifiedChromeOsto require Chrome Verified Access.type: booleanrequired:
- osTypetype: objecttype: arrayrequireAdminApproval:
description: Whether the device needs to be approved bythe customer admin.type: booleanrequireCorpOwned:
description: Whether the device needs to be corp owned.type: booleanrequireScreenLock:
description: |- Whether or not screenlock is required for the DevicePolicy to be true. Defaults to false.type: booleantype: objectipSubnetworks:
description: |- A list of CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for a CIDR IP address block, the specified IP address portion must be properly truncated (i.e. all the host bits must be zero) or the input is considered malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas "2001:db8::1/32" is not. The originating IP of a request must be in one of the listed subnets in order for this Condition to be true. If empty, all IP addresses are allowed.items:
type: stringtype: arraymembers:
items:
description: |- An allowed list of members (users, service accounts). Using groups is not supported. The signed-in user originating the request must be a part of one of the provided members. If not specified, a request may come from any user (logged in/not logged in, not present in any groups, etc.).oneOf:
- required:
- serviceAccountRef
- required:
- userproperties:
serviceAccountRef:
oneOf:
- not:
required:
- externalrequired:
- name
- not:
anyOf:
- required:
- name
- required:
- namespacerequired:
- externalproperties:
external:
description: 'Allowed value: string of the format `serviceAccount:{{value}}`, where {{value}} is the `email` field of an `IAMServiceAccount` resource.'type: stringname:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'type: stringnamespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'type: stringtype: objectuser:
type: stringtype: objecttype: arraynegate:
description: |- Whether to negate the Condition. If true, the Condition becomes a NAND over its non-empty fields, each field must be false for the Condition overall to be satisfied. Defaults to false.type: booleanregions:
description: |- The request must originate from one of the provided countries/regions. Format: A valid ISO 3166-1 alpha-2 code.items:
type: stringtype: arrayrequiredAccessLevels:
items:
description: |- A list of other access levels defined in the same policy. Referencing an AccessContextManagerAccessLevel which does not exist is an error. All access levels listed must be granted for the condition to be true.oneOf:
- not:
required:
- externalrequired:
- name
- not:
anyOf:
- required:
- name
- required:
- namespacerequired:
- externalproperties:
external:
description: 'Allowed value: The `name` field of an `AccessContextManagerAccessLevel` resource.'type: stringname:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'type: stringnamespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'type: stringtype: objecttype: arraytype: objecttype: arrayrequired:
- conditionstype: objectcustom:
description: "Custom access level conditions are set using the Cloud\\ Common Expression Language to represent the necessary conditions\\ for the level to apply to a request. \nSee CEL spec at: https://github.com/google/cel-spec."properties:
expr:
description: "Represents a textual expression in the Common Expression\\ Language (CEL) syntax. CEL is a C-like expression language.\n\ This page details the objects and attributes that are used to\\ the build the CEL expressions for \ncustom access levels - https://cloud.google.com/access-context-manager/docs/custom-access-level-spec."properties:
description:
description: Description of the expression.type: stringexpression:
description: Textual representation of an expression in CommonExpression Language syntax.type: stringlocation:
description: String indicating the location of the expressionfor error reporting, e.g. a file name and a position in thefile.type: stringtitle:
description: Title for the expression, i.e. a short string describingits purpose.type: stringrequired:
- expressiontype: objectrequired:
- exprtype: objectdescription:
description: Description of the AccessLevel and its use. Does not affectbehavior.type: stringresourceID:
description: Immutable. Optional. The name of the resource. Used forcreation and acquisition. When unset, the value of `metadata.name`is used as the default.type: stringtitle:
description: Human readable title. Must be unique within the Policy.type: stringrequired:
- accessPolicyRef
- titletype: objectstatus:
properties:
conditions:
description: Conditions represent the latest available observation ofthe resource's current state.items:
properties:
lastTransitionTime:
description: Last time the condition transitioned from one statusto another.type: stringmessage:
description: Human-readable message indicating details about lasttransition.type: stringreason:
description: Unique, one-word, CamelCase reason for the condition'slast transition.type: stringstatus:
description: Status is the status of the condition. Can be True,False, Unknown.type: stringtype:
description: Type is the type of the condition.type: stringtype: objecttype: arrayobservedGeneration:
description: ObservedGeneration is the generation of the resource thatwas most recently observed by the Config Connector controller. Ifthis is equal to metadata.generation, then that means that the currentreported status reflects the most recent desired state of the resource.type: integertype: objectrequired:
- spectype: object
As described above:
-g MyOpenApiCodegen.class.getCanonicalName()
-i inputFile (a small snippet is shown above)
-o a temporary output directory
Steps to reproduce
Copy paste the personalized Codegen (or just use "java" as an alternative).
Copy paste the given extract (specs) in a YAML file and use it as input.
Use the CLI within the same folder of the personalized Codegen or copy-paste the above java code.
Related issues/PRs
There are many instances of broken code, i.e.: #12883
Suggest a fix
Investigate what is causing the broken generation.
The text was updated successfully, but these errors were encountered:
Hi, could you please provide the complete input file you're using? OpenApiGenerator 6.0.1 doesn't accept the above snippet (java.lang.RuntimeException: Issues with the OpenAPI input. Possible causes: invalid/missing spec, malformed JSON/YAML files, etc.). Also, as far as I know, support for oneOf is still quite new and might have some problems.
Bug Report Checklist
Description
I am trying to generate Java code from an OpenAPI specification (parsing a .yaml file), and the produced result is broken code (i.e., missing commas, "&&" when doing comparisons, = followed by a semicolon straight after). A personalized MyCodegen is utilized as -g argument; the problem persists even when using "java".
The input file is a file whose specifications have been extracted from the following https://github.com/GoogleCloudPlatform/k8s-config-connector/blob/master/install-bundles/install-bundle-workload-identity/crds.yaml.
Examples of broken code:
To clarify, correct format should be:
Wrong comparison method missing '&&':
openapi-generator version
6.0.1
OpenAPI declaration file content or url
This is an extract of the used yaml file.
The customised codegen:
Generation Details
As described above:
-g MyOpenApiCodegen.class.getCanonicalName()
-i inputFile (a small snippet is shown above)
-o a temporary output directory
Steps to reproduce
Copy paste the personalized Codegen (or just use "java" as an alternative).
Copy paste the given extract (specs) in a YAML file and use it as input.
Use the CLI within the same folder of the personalized Codegen or copy-paste the above java code.
Related issues/PRs
There are many instances of broken code, i.e.:
#12883
Suggest a fix
Investigate what is causing the broken generation.
The text was updated successfully, but these errors were encountered: