Skip to content

Commit 487b21d

Browse files
authored
Merge pull request #34058 from jimblye/schemagen-unit-test-failures
Fix schemaGen generated xsd is missing attributes for onError
2 parents 0662810 + d9801b2 commit 487b21d

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

dev/com.ibm.ws.config/src/com/ibm/ws/config/schemagen/internal/SchemaWriter.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2011, 2014 IBM Corporation and others.
2+
* Copyright (c) 2011, 2026 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License 2.0
55
* which accompanies this distribution, and is available at
@@ -1141,9 +1141,14 @@ private void writeTypeMember(final TypeMember member, boolean addCardinalityMinM
11411141
}
11421142

11431143
// If the type is onError then we should generate the onError enum.
1144-
AttributeDefinition optionAD = attribute.getType() == MetaTypeFactory.ON_ERROR_TYPE ? onErrorDefinition : attribute;
1144+
AttributeDefinition optionAD = attribute.getType() == MetaTypeFactory.ON_ERROR_TYPE && onErrorDefinition != null ? onErrorDefinition : attribute;
11451145

11461146
String[] optionValues = optionAD != null ? optionAD.getOptionValues() : null;
1147+
1148+
// If this is an onError type but has no options defined, provide default options
1149+
if (attribute.getType() == MetaTypeFactory.ON_ERROR_TYPE && (optionValues == null || optionValues.length == 0)) {
1150+
optionValues = new String[] { "WARN", "FAIL", "IGNORE" };
1151+
}
11471152

11481153
final boolean altLabel = alternateLabel;
11491154
DocumentationWriter docWriter = new DocumentationWriter() {

dev/com.ibm.ws.config/src/com/ibm/ws/config/schemagen/internal/TypeMember.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2009 IBM Corporation and others.
2+
* Copyright (c) 2009, 2026 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License 2.0
55
* which accompanies this distribution, and is available at
@@ -85,10 +85,8 @@ public String getType(boolean global) {
8585
} else if (global) {
8686
return type.getGlobalSchemaType();
8787
} else {
88-
type.getSchemaBaseType();
88+
return type.getSchemaBaseType();
8989
}
90-
91-
return "xsd:string";
9290
}
9391

9492
public void setCardinality(int cardinality) {

0 commit comments

Comments
 (0)