Skip to content
Written with Claude

HTTP File Options

Configuration for generating HTTP files for NpgsqlRest endpoints, compatible with REST Client extensions and Visual Studio HTTP file support.

Overview

json
json
{
  "NpgsqlRest": {
    "HttpFileOptions": {
      "Enabled": false,
      "Option": "File",
      "Name": null,
      "NamePattern": "{0}_{1}",
      "CommentHeader": "Simple",
      "CommentHeaderIncludeComments": true,
      "FileMode": "Schema",
      "FileOverwrite": true
    }
  }
}

Settings Reference

SettingTypeDefaultDescription
EnabledboolfalseEnable HTTP file generation.
Optionstring"File"Generation mode: "File", "Endpoint", or "Both".
NamestringnullBase file name. Uses database name if null, or "npgsqlrest" if no connection string.
NamePatternstring"{0}_{1}"File name pattern. {0} = database name, {1} = schema suffix (when FileMode is "Schema").
CommentHeaderstring"Simple"Comment header style: "None", "Simple", or "Full".
CommentHeaderIncludeCommentsbooltrueInclude routine comments in header (when CommentHeader is "Simple" or "Full").
FileModestring"Schema"File organization: "Database" or "Schema".
FileOverwritebooltrueOverwrite existing files.

Generation Options

OptionDescription
FileGenerate HTTP files in the file system.
EndpointGenerate endpoint(s) serving HTTP file content.
BothGenerate both file system files and endpoints.

Comment Header Styles

StyleDescription
NoneNo comment header above requests.
SimpleAdd routine name, parameters, and return values (default).
FullAdd entire routine code as comment header.

File Mode

ModeDescription
DatabaseCreate one HTTP file for the entire database.
SchemaCreate one HTTP file per schema.

HTTP Files

HTTP files (.http) are supported by:

These files allow you to send HTTP requests directly from your editor for API testing and documentation.

Example Configuration

Generate HTTP files per schema with full routine documentation:

json
json
{
  "NpgsqlRest": {
    "HttpFileOptions": {
      "Enabled": true,
      "Option": "File",
      "Name": "myapi",
      "NamePattern": "{0}_{1}",
      "CommentHeader": "Full",
      "CommentHeaderIncludeComments": true,
      "FileMode": "Schema",
      "FileOverwrite": true
    }
  }
}

Generate a single HTTP file for the entire database:

json
json
{
  "NpgsqlRest": {
    "HttpFileOptions": {
      "Enabled": true,
      "Option": "File",
      "FileMode": "Database",
      "CommentHeader": "Simple"
    }
  }
}

Serve HTTP files as endpoints:

json
json
{
  "NpgsqlRest": {
    "HttpFileOptions": {
      "Enabled": true,
      "Option": "Endpoint"
    }
  }
}

Next Steps

Comments