Skip to content

Commit

Permalink
Return // void in code sample
Browse files Browse the repository at this point in the history
  • Loading branch information
razor-x committed Sep 25, 2024
1 parent 9228288 commit e487c86
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/lib/code-sample/javascript.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { camelCase } from 'change-case'

import { createJsonResponse } from './create-json-response.js'
import { createJsonResponse } from './json.js'
import type { CodeSampleDefinition, Context } from './schema.js'

export const createJavascriptRequest = (
Expand Down
File renamed without changes.
7 changes: 5 additions & 2 deletions src/lib/code-sample/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,16 @@ export const createCodeSample = async (
codeSampleDefinition: CodeSampleDefinition,
context: Context,
): Promise<CodeSample> => {
const isVoidResponse = context.endpoint.response.responseType === 'void'
const code: Code = {
javascript: {
title: 'JavaScript',
request: createJavascriptRequest(codeSampleDefinition, context),
response: createJavascriptResponse(codeSampleDefinition, context),
response: isVoidResponse
? '// void'
: createJavascriptResponse(codeSampleDefinition, context),
request_syntax: 'javascript',
response_syntax: 'json',
response_syntax: isVoidResponse ? 'javascript' : 'json',
},
python: {
title: 'Python',
Expand Down
2 changes: 1 addition & 1 deletion src/lib/code-sample/seam-cli.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { kebabCase } from 'change-case'

import { createJsonResponse } from './create-json-response.js'
import { createJsonResponse } from './json.js'
import type { CodeSampleDefinition, Context } from './schema.js'

export const createSeamCliRequest = (
Expand Down

0 comments on commit e487c86

Please sign in to comment.