Skip to content

fix(spec): remove lifecycle markup from PolicyType DEVICE_SIGNAL_COLLECTION value - #602

Open
iftikharlodhi1-prog wants to merge 3 commits into
okta:masterfrom
iftikharlodhi1-prog:fix/policy-type-device-signal-collection-enum
Open

iftikharlodhi1-prog wants to merge 3 commits into
okta:masterfrom
iftikharlodhi1-prog:fix/policy-type-device-signal-collection-enum

Conversation

@iftikharlodhi1-prog

Copy link
Copy Markdown

Problem

In openapi/api.yaml, the PolicyType enum contains this value:

- <x-lifecycle class="ea"></x-lifecycle> DEVICE_SIGNAL_COLLECTION

A documentation lifecycle badge leaked into the enum value itself. The generator turned it into a member whose value contains the HTML tag, and there is no plain DEVICE_SIGNAL_COLLECTION member.

The API returns "DEVICE_SIGNAL_COLLECTION". Policy.from_dict correctly routes that string to DeviceSignalCollectionPolicy, but validation of the type field then fails:

ValidationError: 1 validation error for DeviceSignalCollectionPolicy
type
  Input should be '<x-lifecycle class="ea"></x-lifecycle> DEVICE_SIGNAL_COLLECTION', 'ACCESS_POLICY', ...

As a result, get_policy and list_policies raise for any org that has a device signal collection policy. Also, PolicyType("DEVICE_SIGNAL_COLLECTION") raises ValueError.

Fix

  • openapi/api.yaml: the enum value is now DEVICE_SIGNAL_COLLECTION. The badge stays in the description, where it belongs.
  • okta/models/policy_type.py: the mangled member is replaced with DEVICE_SIGNAL_COLLECTION = "DEVICE_SIGNAL_COLLECTION". This matches what the generator produces from the corrected spec.
  • tests/test_policy_type_enum.py: new regression tests covering:
    • the enum value
    • a check that no enum value contains markup
    • discriminator deserialization
    • a to_dict round trip
    • every documented policy type

Testing

  • The new tests fail on master (6 failures) and pass with this change (14 passed).
  • The full unit suite passes: pytest tests --ignore=tests/integration gives 260 passed.

Related

The same markup appears in okta/okta-sdk-nodejs (oas-spec/management.yaml, 3 occurrences), so the Node SDK likely has the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant