Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix, ir-generation: put fully substituted path in url field of auto-generated EndpointExampleCalls #4211

Merged
merged 8 commits into from
Aug 5, 2024

Conversation

dcb6
Copy link
Contributor

@dcb6 dcb6 commented Aug 5, 2024

For user-provided example endpoint calls, we were already doing this, code here

@@ -204,8 +204,7 @@ export class ExampleGenerator {
const examples = [
...endpoint.userSpecifiedExamples.map((userSpecified) => userSpecified.example).filter(isNonNullish)
];
return {
url: endpoint.path.head,
const exampleWithoutUrl = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

core change here

@dcb6 dcb6 marked this pull request as ready for review August 5, 2024 20:38
@dcb6 dcb6 requested a review from dsinghvi as a code owner August 5, 2024 20:38
@@ -2570,7 +2570,7 @@
"autogeneratedExamples": [
{
"example": {
"url": "/path/",
"url": "/path/>/>/red/red",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just noticed this and looking into it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spec here:

service:
  auth: false
  base-path: ""
  endpoints:
    send:
      path: /path/{operand}/{maybeOperand}/{operandOrColor}/{maybeOperandOrColor}
      method: POST
      path-parameters: 
        operand: root.Operand
        maybeOperand: optional<root.Operand>
        operandOrColor: root.ColorOrOperand
        maybeOperandOrColor: optional<root.ColorOrOperand>
      examples: 
        - path-parameters:
            operand: $root.Operand.GreaterThan
            maybeOperand: $root.Operand.LessThan
            operandOrColor: $root.ColorOrOperand.Red
            maybeOperandOrColor: $root.ColorOrOperand.Red

types: 
  Operand:
    docs: | 
      Tests enum name and value can be 
      different.
    enum:
      - value: ">"
        name: GREATER_THAN 
      - value: "="
        name: EQUAL_TO
      - value: "less_than"
        docs: | 
          The name and value should be similar
          are similar for less than. 
    examples:
      - name: GreaterThan
        value: ">"
      - name: LessThan
        value: "less_than"
  
  Color:
    enum:
      - value: "red"
        name: RED 
      - value: "blue"
        name: BLUE
    examples:
      - name: Red
        value: "red"
  
  ColorOrOperand:
    discriminated: false
    union:
      - Color
      - Operand
    examples:
      - name: Red
        value: "red"

@@ -526,7 +526,7 @@
"autogeneratedExamples": [
{
"example": {
"url": "",
"url": "/",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dcb6 this feels wrong ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, fixed!

@dcb6 dcb6 changed the title fix: put fully substituted path in url field of auto-generated EndpointExampleCalls fix, ir-generation: put fully substituted path in url field of auto-generated EndpointExampleCalls Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants