-
Notifications
You must be signed in to change notification settings - Fork 1
feat: allow comments by removing them #22
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
Conversation
Сходу не заработало: diff --git examples/js/endpoints.yaml examples/js/endpoints.yaml
index 7d1d09a..163f902 100644
--- examples/js/endpoints.yaml
+++ examples/js/endpoints.yaml
@@ -18,6 +18,7 @@
- path: /v1/collections/:collectionId/categories/count
get:
query: >-
+ -- SQL comments can be used but they won't be included in the resulted code
SELECT COUNT(DISTINCT s.category_id) AS counter
FROM collections_series cs
JOIN series s
diff --git examples/js/routes.js examples/js/routes.js
index a6d39a3..043cf40 100644
--- examples/js/routes.js
+++ examples/js/routes.js
@@ -19,7 +19,7 @@ app.get('/v1/categories/count', (req, res) => {
app.get('/v1/collections/:collectionId/categories/count', (req, res) => {
pool.query(
- 'SELECT COUNT(DISTINCT s.category_id) AS counter FROM collections_series cs JOIN series s ON s.id = cs.series_id WHERE cs.collection_id = :collectionId',
+ ' FROM collections_series cs JOIN series s ON s.id = cs.series_id WHERE cs.collection_id = :collectionId',
{ "collectionId": req.params.collectionId },
(err, rows, fields) => {
if (err) {
diff --git examples/python/routes.py examples/python/routes.py
index 2035404..d36a06d 100644
--- examples/python/routes.py
+++ examples/python/routes.py
@@ -51,7 +51,7 @@ def get_v1_collections_collection_id_categories_count(collectionId, conn = Depen
try:
with conn:
with conn.cursor(cursor_factory = psycopg2.extras.RealDictCursor) as cur:
- cur.execute("SELECT COUNT(DISTINCT s.category_id) AS counter FROM collections_series cs JOIN series s ON s.id = cs.series_id WHERE cs.collection_id = %(collectionId)s", { "collectionId": collectionId })
+ cur.execute(" FROM collections_series cs JOIN series s ON s.id = cs.series_id WHERE cs.collection_id = %(collectionId)s", { "collectionId": collectionId })
result = cur.fetchone()
if result is None:
raise HTTPException(status_code=404) |
Проблема проявляется когда комментарий указан в начале, перед SQL-запросом -- почему-то после нее не добавляется перевод строки. Ок, тогда пока, оставляю PR открытым. |
Можно использовать |
examples/js/endpoints.yaml
Outdated
JOIN series s | ||
ON s.id = cs.series_id | ||
WHERE cs.collection_id = :p.collectionId | ||
WHERE cs.collection_id = :p.collectionId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Зачем это изменение?
@@ -42,7 +45,7 @@ | |||
id: | |||
type: integer | |||
post: | |||
query: >- | |||
query: |- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Зачем везде менять понадобилось-то?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Для наглядности, чтобы уменьшить шанс того, что кому-то придет в голову использовать >-
с комментариями :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не надо править то, что не сломалось :)
66da47c
to
9937fbe
Compare
No description provided.