mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
remove logging
This commit is contained in:
parent
b61c89d69d
commit
ca01146337
@ -137,11 +137,11 @@ export function EnhancedAPIPage({ document, operations, description }: EnhancedA
|
||||
|
||||
// Helper function to generate example data from OpenAPI schema
|
||||
const generateExampleFromSchema = useCallback((schema: OpenAPISchema, spec?: OpenAPISpec): unknown => {
|
||||
console.log('Processing schema:', JSON.stringify(schema, null, 2));
|
||||
//console.log('Processing schema:', JSON.stringify(schema, null, 2));
|
||||
|
||||
// Handle $ref references first
|
||||
if (schema.$ref) {
|
||||
console.log('Found $ref:', schema.$ref);
|
||||
//console.log('Found $ref:', schema.$ref);
|
||||
const refPath = schema.$ref.replace('#/', '').split('/');
|
||||
let refSchema: OpenAPISchema | undefined = spec as unknown as OpenAPISchema;
|
||||
for (const part of refPath) {
|
||||
@ -152,7 +152,7 @@ export function EnhancedAPIPage({ document, operations, description }: EnhancedA
|
||||
|
||||
// Handle allOf (merge all schemas)
|
||||
if (schema.allOf?.length) {
|
||||
console.log('Found allOf with', schema.allOf.length, 'schemas');
|
||||
//console.log('Found allOf with', schema.allOf.length, 'schemas');
|
||||
const merged: Record<string, unknown> = {};
|
||||
for (const subSchema of schema.allOf) {
|
||||
const subExample = generateExampleFromSchema(subSchema, spec);
|
||||
@ -166,17 +166,17 @@ export function EnhancedAPIPage({ document, operations, description }: EnhancedA
|
||||
// Handle oneOf/anyOf (use first schema)
|
||||
if (schema.oneOf?.length || schema.anyOf?.length) {
|
||||
const schemas = schema.oneOf || schema.anyOf;
|
||||
console.log('Found oneOf/anyOf with', schemas?.length, 'schemas');
|
||||
//console.log('Found oneOf/anyOf with', schemas?.length, 'schemas');
|
||||
return generateExampleFromSchema(schemas![0], spec);
|
||||
}
|
||||
|
||||
// Handle object type - prioritize this over top-level examples
|
||||
if (schema.type === 'object' && schema.properties) {
|
||||
console.log('Processing object with properties:', Object.keys(schema.properties));
|
||||
//console.log('Processing object with properties:', Object.keys(schema.properties));
|
||||
const example: Record<string, unknown> = {};
|
||||
|
||||
Object.entries(schema.properties).forEach(([key, prop]: [string, OpenAPISchema]) => {
|
||||
console.log(`Processing property ${key}:`, prop);
|
||||
//console.log(`Processing property ${key}:`, prop);
|
||||
|
||||
if (prop.example !== undefined) {
|
||||
example[key] = prop.example;
|
||||
@ -186,13 +186,13 @@ export function EnhancedAPIPage({ document, operations, description }: EnhancedA
|
||||
}
|
||||
});
|
||||
|
||||
console.log('Generated object example:', example);
|
||||
//console.log('Generated object example:', example);
|
||||
return example;
|
||||
}
|
||||
|
||||
// Handle direct examples only for non-object types
|
||||
if (schema.example !== undefined) {
|
||||
console.log('Found direct example:', schema.example);
|
||||
//console.log('Found direct example:', schema.example);
|
||||
return schema.example;
|
||||
}
|
||||
|
||||
@ -217,9 +217,9 @@ export function EnhancedAPIPage({ document, operations, description }: EnhancedA
|
||||
|
||||
if (operation.requestBody?.content['application/json']?.schema) {
|
||||
const { schema: jsonSchema } = operation.requestBody.content['application/json'];
|
||||
console.log('OpenAPI Schema for', firstOperation.path, ':', jsonSchema);
|
||||
//console.log('OpenAPI Schema for', firstOperation.path, ':', jsonSchema);
|
||||
const exampleBody = generateExampleFromSchema(jsonSchema, spec);
|
||||
console.log('Generated example body:', exampleBody);
|
||||
//console.log('Generated example body:', exampleBody);
|
||||
setRequestState(prev => ({
|
||||
...prev,
|
||||
body: JSON.stringify(exampleBody, null, 2)
|
||||
|
||||
@ -290,9 +290,9 @@ function ModernWebhookDisplay({
|
||||
const getPayloadExample = useCallback(() => {
|
||||
if (webhook.requestBody?.content['application/json']?.schema) {
|
||||
const jsonContent = webhook.requestBody.content['application/json'];
|
||||
console.log('Webhook schema:', JSON.stringify(jsonContent.schema, null, 2));
|
||||
// console.log('Webhook schema:', JSON.stringify(jsonContent.schema, null, 2));
|
||||
const examplePayload = generateExampleFromSchema(jsonContent.schema, spec);
|
||||
console.log('Generated payload:', JSON.stringify(examplePayload, null, 2));
|
||||
// console.log('Generated payload:', JSON.stringify(examplePayload, null, 2));
|
||||
return JSON.stringify(examplePayload, null, 2);
|
||||
}
|
||||
|
||||
|
||||
@ -318,7 +318,7 @@ export default function DocsSelector() {
|
||||
}, [preferredPlatform, isLoaded]);
|
||||
|
||||
const handleSectionSelect = (section: DocsSection) => {
|
||||
console.log("Selected section:", section);
|
||||
//console.log("Selected section:", section);
|
||||
// Navigate to the selected section
|
||||
if (section.url) {
|
||||
window.location.href = section.url;
|
||||
|
||||
@ -104,7 +104,7 @@ export function DynamicDocsLayout({ children, ...props }: DynamicDocsLayoutProps
|
||||
if (isInSdkSection(pathname)) {
|
||||
const sdkTree = findSectionInTree(props.tree, 'SDK Reference', pathname);
|
||||
if (sdkTree) {
|
||||
console.log('🎯 Using SDK tree for:', pathname);
|
||||
//console.log('🎯 Using SDK tree for:', pathname);
|
||||
return sdkTree;
|
||||
}
|
||||
}
|
||||
@ -112,13 +112,13 @@ export function DynamicDocsLayout({ children, ...props }: DynamicDocsLayoutProps
|
||||
if (isInComponentsSection(pathname)) {
|
||||
const componentsTree = findSectionInTree(props.tree, 'Components', pathname);
|
||||
if (componentsTree) {
|
||||
console.log('🎯 Using Components tree for:', pathname);
|
||||
//console.log('🎯 Using Components tree for:', pathname);
|
||||
return componentsTree;
|
||||
}
|
||||
}
|
||||
|
||||
// For normal docs view, filter out SDK and Components sections
|
||||
console.log('📄 Using filtered page tree for:', pathname);
|
||||
//console.log('📄 Using filtered page tree for:', pathname);
|
||||
return {
|
||||
...props.tree,
|
||||
children: props.tree.children.map(platformNode => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user