Skip to content

Commit f58dd81

Browse files
fix(GroupProfile): restore custom group-profile attribute extensibility
GroupProfile lost its extensibility after 6.6.0 (#365): because it is not marked x-okta-extensible, ObjectSerializer strips custom group-profile attributes (those added via the Schemas API, e.g. an org-chart id) on both serialize and deserialize, so they never reach Okta on writes and are dropped on reads. Add GroupProfile to the force-extensible list in scripts/fixSpec.cjs — matching UserProfile and OktaUserGroupProfile, which remain extensible — and regenerate. This restores the typed index signature and `static readonly isExtensible = true` so custom attributes round-trip again. Refs #238, okta/okta-sdk-java#1642.
1 parent 92560f9 commit f58dd81

4 files changed

Lines changed: 55 additions & 4 deletions

File tree

scripts/fixSpec.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ function fixExtensibleSchemas(spec) {
505505
// Schemas to add `x-okta-extensible`
506506
const schemasToForceExtensible = [
507507
'UserProfile',
508+
'GroupProfile',
508509
];
509510

510511
for (const schemaKey in spec.components.schemas) {

src/generated/models/GroupProfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,4 @@ GroupProfile.attributeTypeMap = [
7575
'format': ''
7676
}
7777
];
78+
GroupProfile.isExtensible = true;

src/types/generated/models/GroupProfile.d.ts

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*!
2+
* Copyright (c) 2017-present, Okta, Inc. and/or its affiliates. All rights reserved.
3+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4+
*
5+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6+
* Unless required by applicable law or agreed to in writing, software
7+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
*
10+
* See the License for the specific language governing permissions and limitations under the License.
11+
*/
12+
13+
import { expect } from 'chai';
14+
import { ObjectSerializer } from '../../src/generated/models/ObjectSerializer';
15+
16+
// Regression test for: custom GroupProfile attributes stripped by the serializer.
17+
// Root cause: GroupProfile was not marked x-okta-extensible, so ObjectSerializer
18+
// discarded schema-extension attributes (those added via the Schemas API) on
19+
// both serialize and deserialize, matching the behavior of UserProfile and
20+
// OktaUserGroupProfile which remain extensible.
21+
22+
describe('GroupProfile serialization', () => {
23+
it('preserves custom (schema-extension) attributes during serialization', () => {
24+
const input = {
25+
name: 'West Coast Users',
26+
description: 'All West Coast users',
27+
customAttribute: 'custom-value',
28+
};
29+
30+
const serialized = ObjectSerializer.serialize(input, 'GroupProfile', '');
31+
32+
expect(serialized).to.have.property('name', 'West Coast Users');
33+
expect(serialized).to.have.property('customAttribute', 'custom-value');
34+
});
35+
36+
it('preserves custom (schema-extension) attributes during deserialization', () => {
37+
const raw = {
38+
name: 'West Coast Users',
39+
customAttribute: 'custom-value',
40+
};
41+
42+
const deserialized = ObjectSerializer.deserialize(raw, 'GroupProfile', '');
43+
44+
expect(deserialized).to.have.property('customAttribute', 'custom-value');
45+
});
46+
});

0 commit comments

Comments
 (0)