Comments (5)
The definitions for given file are stored in the index document and can be retrieved via IndexDocument#getDefinitions(File file)
. The Definitions
object returned contains data such as map of symbol name to line number, map of line numbers to tag, and set of tags. Tag contains information such as line number, symbol name, type, full line string, namespace, signature, start/end offsets within the line. The question is what and how to represent this information in the API results. A good practice is to introduce a DTO (Data Transfer Object) to make this information available in the API. The DTO can contain a subset of the data from the Definitions
object, it is just a question which data and in what form.
The API calls would obviously need to go through authorization checks.
from opengrok.
Also, the above suggests the API endpoint would be limited to single file, i.e.be similar to the pre-existing genre API, i.e. api/v1/file/defs?path=
from opengrok.
Also, pagination should be considered as the "tags" data for some files can be significant. On the other hand, I don't want to complicate this API endpoint too much.
from opengrok.
Speaking of simplicity, it would seem to me that the API should merely present the list of tags, i.e. the contents of Definitions#tags
list. The items of the list, Tag
objects, contain various interesting pieces of information:
If one needs the line to tag mapping, that could be reconstructed from the list.
Would that match your use case @ronvgs ?
from opengrok.
Here's a sample output for https://github.com/openssl/openssl/blob/master/crypto/aes/aes_cbc.c (the query URL would end with /api/v1/file/defs?path=/openssl-master/crypto/aes/aes_cbc.c
):
[
{
"type": "function",
"signature": "(const unsigned char * in,unsigned char * out,size_t len,const AES_KEY * key,unsigned char * ivec,const int enc)",
"text": "void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,",
"symbol": "AES_cbc_encrypt",
"lineStart": 5,
"lineEnd": 20,
"line": 20,
"namespace": null
},
{
"type": "argument",
"signature": "(const unsigned char * in,unsigned char * out,size_t len,const AES_KEY * key,unsigned char * ivec,const int enc)",
"text": "AES_cbc_encrypt(const unsigned char * in,unsigned char * out,size_t len,const AES_KEY * key,unsigned char * ivec,const int enc)",
"symbol": "in",
"lineStart": 21,
"lineEnd": 44,
"line": 20,
"namespace": null
},
{
"type": "argument",
"signature": "(const unsigned char * in,unsigned char * out,size_t len,const AES_KEY * key,unsigned char * ivec,const int enc)",
"text": "AES_cbc_encrypt(const unsigned char * in,unsigned char * out,size_t len,const AES_KEY * key,unsigned char * ivec,const int enc)",
"symbol": "out",
"lineStart": 46,
"lineEnd": 64,
"line": 20,
"namespace": null
},
{
"type": "argument",
"signature": "(const unsigned char * in,unsigned char * out,size_t len,const AES_KEY * key,unsigned char * ivec,const int enc)",
"text": "AES_cbc_encrypt(const unsigned char * in,unsigned char * out,size_t len,const AES_KEY * key,unsigned char * ivec,const int enc)",
"symbol": "len",
"lineStart": 21,
"lineEnd": 31,
"line": 21,
"namespace": null
},
{
"type": "argument",
"signature": "(const unsigned char * in,unsigned char * out,size_t len,const AES_KEY * key,unsigned char * ivec,const int enc)",
"text": "AES_cbc_encrypt(const unsigned char * in,unsigned char * out,size_t len,const AES_KEY * key,unsigned char * ivec,const int enc)",
"symbol": "key",
"lineStart": 33,
"lineEnd": 51,
"line": 21,
"namespace": null
},
{
"type": "argument",
"signature": "(const unsigned char * in,unsigned char * out,size_t len,const AES_KEY * key,unsigned char * ivec,const int enc)",
"text": "AES_cbc_encrypt(const unsigned char * in,unsigned char * out,size_t len,const AES_KEY * key,unsigned char * ivec,const int enc)",
"symbol": "ivec",
"lineStart": 21,
"lineEnd": 40,
"line": 22,
"namespace": null
},
{
"type": "argument",
"signature": "(const unsigned char * in,unsigned char * out,size_t len,const AES_KEY * key,unsigned char * ivec,const int enc)",
"text": "AES_cbc_encrypt(const unsigned char * in,unsigned char * out,size_t len,const AES_KEY * key,unsigned char * ivec,const int enc)",
"symbol": "enc",
"lineStart": 42,
"lineEnd": 55,
"line": 22,
"namespace": null
}
]
from opengrok.
Related Issues (20)
- replace docker build with modern alternative
- No module named 'opengrok_tools' in Docker HOT 5
- Installing opengrok-tools.tar.gz fails from 1.12.24 HOT 2
- configuration.xml gets truncated in 1.12.26 HOT 1
- genre check for hasAnnotation() is not enough HOT 2
- Test Python Package fails HOT 8
- `READONLY_CONFIG_FILE` doesn't work in docker containers HOT 1
- make the "is-annotatable" check more precise
- Opengrok web application isn't accessible during reindex HOT 8
- OpenGrok Indexer. FileNotFoundException while indexing directories HOT 8
- Fix typo in CONTRIBUTING.md file HOT 1
- cannot remove suggester data for extended period of time due to pending rebuilds
- binary data in logs again due to annotation processing HOT 1
- indexer might degrade to serial processing for the trailing project HOT 1
- limit addFile() processing time HOT 1
- Opengrok not showing projects - indexer is working.
- Dockerfile requests a vulnerable version of Apache Tomcat HOT 1
- Support GitHub repos that only allow checkout through web URLs
- History based reindex is on, however history is off. History has to be enabled for history based reindex
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opengrok.