-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathopenapi.yaml
More file actions
207 lines (199 loc) · 6.24 KB
/
Copy pathopenapi.yaml
File metadata and controls
207 lines (199 loc) · 6.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
openapi: 3.0.3
info:
title: LeanExplore API
version: v1.0.2
description: >-
The LeanExplore API provides programmatic access to search and retrieve
Lean 4 declarations from indexed projects including Mathlib, PhysLean,
FLT, and more.
The API is public and does not require authentication. Legacy API-key
headers are accepted by the HTTP stack but have no effect.
contact:
name: Justin Asher
email: justinchadwickasher@gmail.com
url: https://www.leanexplore.com
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
tags:
- name: Search
description: Endpoints for searching Lean declarations.
- name: Declarations
description: Endpoints for retrieving specific declarations by ID.
servers:
- url: https://www.leanexplore.com/api/v2
description: Production LeanExplore API Server
components:
schemas:
SearchResult:
type: object
description: A Lean declaration returned from search or retrieval.
required:
- id
- name
- module
- source_text
- source_link
properties:
id:
type: integer
format: int64
description: Unique identifier for the declaration.
example: 12345
name:
type: string
description: Fully qualified Lean name.
example: "Nat.add_comm"
module:
type: string
description: Module containing the declaration.
example: "Mathlib.Data.Nat.Basic"
docstring:
type: string
nullable: true
description: Documentation string from source code.
example: "Addition of natural numbers is commutative."
source_text:
type: string
description: The Lean source code for this declaration.
example: "theorem Nat.add_comm (n m : Nat) : n + m = m + n := by omega"
source_link:
type: string
description: GitHub URL to the declaration source.
example: "https://github.com/leanprover-community/mathlib4/blob/master/Mathlib/Data/Nat/Basic.lean#L42"
dependencies:
type: string
nullable: true
description: JSON array of declaration names this declaration depends on.
example: "[\"Nat.add\", \"Nat.zero\"]"
informalization:
type: string
nullable: true
description: Natural language description of the declaration.
example: "The sum of two natural numbers is the same regardless of order."
SearchResponse:
type: object
description: Response from a search operation.
required:
- query
- results
- count
properties:
query:
type: string
description: The original search query string.
example: "commutative addition"
results:
type: array
items:
$ref: '#/components/schemas/SearchResult'
description: List of matching declarations.
count:
type: integer
description: Number of results returned.
example: 10
processing_time_ms:
type: integer
nullable: true
description: Server-side processing time in milliseconds.
example: 45
ApiError:
type: object
description: Error response.
required:
- msg
properties:
msg:
type: string
description: Human-readable error message.
example: "Invalid request"
paths:
/search:
get:
summary: Search Declarations
description: Search for Lean declarations using natural language or Lean syntax.
operationId: searchDeclarations
tags:
- Search
parameters:
- name: q
in: query
required: true
description: The search query string.
schema:
type: string
example: "prime number theorem"
- name: limit
in: query
required: false
description: Maximum number of results to return (default 20).
schema:
type: integer
default: 20
example: 10
responses:
'200':
description: Successful search.
content:
application/json:
schema:
$ref: '#/components/schemas/SearchResponse'
'400':
description: Bad Request - Invalid or missing query.
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
'429':
description: Too Many Requests - Per-IP search limit of 30 requests per minute exceeded.
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
'500':
description: Internal Server Error.
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
/declarations/{declaration_id}:
get:
summary: Get Declaration by ID
description: Retrieve a specific declaration by its unique ID.
operationId: getDeclarationById
tags:
- Declarations
parameters:
- name: declaration_id
in: path
required: true
description: The unique declaration ID.
schema:
type: integer
format: int64
example: 12345
responses:
'200':
description: Successfully retrieved declaration.
content:
application/json:
schema:
$ref: '#/components/schemas/SearchResult'
'404':
description: Not Found - Declaration does not exist.
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
'429':
description: Too Many Requests - Per-IP declaration limit of 240 requests per minute exceeded.
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
'500':
description: Internal Server Error.
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'