Skip to content

Commit 2040f11

Browse files
committed
remove minProperties = 1 check
Signed-off-by: xil <fridalu66@gmail.com>
1 parent 5f299eb commit 2040f11

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

.github/workflows/convert-proto.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
jobs:
1111
auto-proto-convert:
1212
runs-on: ubuntu-latest
13-
#if: github.repository == 'opensearch-project/opensearch-protobufs'
13+
if: github.repository == 'opensearch-project/opensearch-protobufs'
1414
steps:
1515
- name: Checkout Repository
1616
uses: actions/checkout@v4

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
66
### Added
77
- Preprocessing - Support x-protobuf-name overrides existing property and parameter name ([#306](https://github.com/opensearch-project/opensearch-protobufs/pull/306))
88
- Preprocessing - Handling spec added/deprecated versioning.([#309](https://github.com/opensearch-project/opensearch-protobufs/pull/309))
9-
- preprocessing - Support minProperties=1 and maxProperties=1 constraints by marking them as `oneof` for protobuf generation ([#317](https://github.com/opensearch-project/opensearch-protobufs/pull/317))
9+
- preprocessing - Support maxProperties=1 constraints by marking them as `oneof` for protobuf generation ([#317](https://github.com/opensearch-project/opensearch-protobufs/pull/317))
1010

1111
### Changed
1212

tools/proto-convert/src/SchemaModifier.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -479,12 +479,11 @@ export class SchemaModifier {
479479

480480
/**
481481
* Marks schemas and properties with oneOf extensions.
482-
* Adds x-oneof-property to properties when schema has minProperties=1 and maxProperties=1.
483-
* Adds x-oneof-schema to schemas that have the min/max pattern AND to parent schemas
484-
* that contain nested schemas with the pattern.
482+
* Adds x-oneof-property to properties when schema has maxProperties=1.
483+
* Adds x-oneof-schema to schemas that have the max pattern AND to parent schemas
485484
**/
486485
markOneOfExtensions(schema: OpenAPIV3.SchemaObject): void {
487-
const hasDirectPattern = schema.minProperties === 1 && schema.maxProperties === 1;
486+
const hasDirectPattern = schema.maxProperties === 1;
488487
const hasNestedPattern = this.hasNestedOneOfPattern(schema);
489488

490489
if (!hasDirectPattern && !hasNestedPattern) {
@@ -548,7 +547,7 @@ export class SchemaModifier {
548547
for (const item of items) {
549548
if (item && typeof item === 'object' && !('$ref' in item)) {
550549
const itemSchema = item as any;
551-
if (itemSchema.minProperties === 1 && itemSchema.maxProperties === 1) {
550+
if (itemSchema.maxProperties === 1) {
552551
return true;
553552
}
554553
}

0 commit comments

Comments
 (0)