Skip to content

Commit

Permalink
fix(openrpc): handle require false (#2093)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsinghvi authored Jan 30, 2025
1 parent c425af4 commit e68acfc
Show file tree
Hide file tree
Showing 5 changed files with 1,674 additions and 1,437 deletions.
2 changes: 1 addition & 1 deletion packages/parsers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fern-api/docs-parsers",
"version": "0.0.42",
"version": "0.0.43",
"repository": {
"type": "git",
"url": "https://github.com/fern-api/fern-platform.git",
Expand Down
11 changes: 10 additions & 1 deletion packages/parsers/src/openrpc/1.x/MethodConverter.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,16 @@ export class MethodConverterNode extends BaseOpenrpcConverterNode<

return {
key: FernRegistry.PropertyKey(param.name),
valueShape,
valueShape: !param.required
? {
type: "alias",
value: {
type: "optional",
shape: valueShape,
default: undefined,
},
}
: valueShape,
description: param.description,
availability: undefined,
};
Expand Down
34 changes: 26 additions & 8 deletions packages/parsers/src/openrpc/__test__/__snapshots__/ethereum.json
Original file line number Diff line number Diff line change
Expand Up @@ -1389,10 +1389,16 @@
"valueShape": {
"type": "alias",
"value": {
"type": "primitive",
"value": {
"type": "string",
"regex": "^0x[a-fA-F\\d]+$"
"type": "optional",
"shape": {
"type": "alias",
"value": {
"type": "primitive",
"value": {
"type": "string",
"regex": "^0x[a-fA-F\\d]+$"
}
}
}
}
},
Expand Down Expand Up @@ -2164,8 +2170,14 @@
"valueShape": {
"type": "alias",
"value": {
"type": "id",
"id": "BlockNumber"
"type": "optional",
"shape": {
"type": "alias",
"value": {
"type": "id",
"id": "BlockNumber"
}
}
}
},
"description": "A BlockNumber at which to request the balance"
Expand Down Expand Up @@ -2641,8 +2653,14 @@
"valueShape": {
"type": "alias",
"value": {
"type": "id",
"id": "BlockNumber"
"type": "optional",
"shape": {
"type": "alias",
"value": {
"type": "id",
"id": "BlockNumber"
}
}
}
},
"description": "A BlockNumber of which the code existed"
Expand Down
26 changes: 19 additions & 7 deletions packages/parsers/src/openrpc/__test__/__snapshots__/petstore.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,16 @@
"valueShape": {
"type": "alias",
"value": {
"type": "primitive",
"value": {
"type": "integer",
"minimum": 1
"type": "optional",
"shape": {
"type": "alias",
"value": {
"type": "primitive",
"value": {
"type": "integer",
"minimum": 1
}
}
}
}
},
Expand Down Expand Up @@ -242,9 +248,15 @@
"valueShape": {
"type": "alias",
"value": {
"type": "primitive",
"value": {
"type": "string"
"type": "optional",
"shape": {
"type": "alias",
"value": {
"type": "primitive",
"value": {
"type": "string"
}
}
}
}
},
Expand Down
Loading

0 comments on commit e68acfc

Please sign in to comment.